I currently have a simple website setup with ASP.NET Core MVC (.NET 4.6.1), and I would like to periodically perform some processes, such as automatically sending emails at the end of each day to registered members.
After some searching, I came across two common solutions - Quartz.NET and FluentScheduler.
Based on this SO thread , I found the FluentScheduler usage approach easier to digest and use for my simple task. After quickly embedding the following lines of code in my Program.cs class, I had emails that came out successfully every minute (for testing purposes).
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
var registry = new Registry();
JobManager.Initialize(registry);
JobManager.AddJob(() => MyEmailService.SendEmail(), s => s
.ToRunEvery(1)
.Minutes());
host.Run();
}
}
, , , . . Entity Framework Context / SQL.
, , ?
, , !