Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.01 KB

README.md

File metadata and controls

34 lines (26 loc) · 1.01 KB

AndroThink.WebJob.Core Nuget

Library that help in configuring new dot net core web job project

How to use

In Your Control

var job = CoreWebJob.Create("appsettings.json", true)
    .ConfigureWebJobs(options =>
    {

    }).ConfigureLogging((context, logging) =>
    {
        logging.AddConsole();
        logging.SetMinimumLevel(LogLevel.Trace);
    })
    .ConfigureServices((context, services) =>
    {
        services.AddSingleton<IMailSender,MailSender>();

        services.AddHostedService<TestService>(); // this inherites from BaseHostedService OR BaseBackgroundService
    })
    .WithFileLogger("Logs");

await job.RunAsync((sender, args) =>
{
    Exception ex = (Exception)args.ExceptionObject;

    Console.WriteLine("Webjob exception ==> " + ex.ToString());
});