Raskolnikov
Raskolnikov

Reputation: 4009

Azure WebJobs dependency injection, with non-static methods?

I am new to web-jobs so I need some help to make this clear. I have web job.

public static class Functions
    {
//.....
    public static async Task RevalidateImport(
        [QueueTrigger(QueueName.StorageRevalidate)] RevalidateImportCommand command,
        TextWriter logWriter)
    {
        await logWriter.WriteLineAsync("Start");
        try
        {
            //Do something
        }
        catch (Exception ex)
        {
            //Log
        }
        await logWriter.WriteLineAsync("End");
    }
//.....
}

Is it possible to have non-static class, with non static web jobs? I want have unit testable class.Also I want inject some stuff in this class.

Upvotes: 3

Views: 2704

Answers (1)

Raskolnikov
Raskolnikov

Reputation: 4009

I found solution. I looks simple.
Azure WebJobs dependency injection with SimpleInjector.

Upvotes: 1

Related Questions