<t>Azure WebJobs SDK now supports instance methods. Combining this with a custom IJobActivator allows you to use DI.<br/>
<br/>
First, create the custom IJobActivator that can resolve a job type using your favourite DI container:<br/>
<br/>
public class MyActivator : IJobActivator<br/>
{<br/>
private readonly IUnityContainer _container;<br/>
<br/>
public MyActivator(IUnityContainer container)<br/>
{<br/>
_container = container;<br/>
}<br/>
<br/>
public T CreateInstance()<br/>
{<br/>
return _container.Resolve();<br/>
}<br/>
}<br/>
<br/>
```<br/>
<br/>
You need to register this class using a custom JobHostConfiguration:<br/>
<br/>
```<br/>
var config = new JobHostConfiguration<br/>
{<br/>
JobActivator = new MyActivator(myContainer)<br/>
};<br/>
var host = new JobHost(config);<br/>
<br/>
```<br/>
<br/>
Then, you can use a simple class with instance methods for your jobs (here I'm using Unity's constructor injection feature):<br/>
<br/>
```<br/>
public class MyFunctions<br/>
{<br/>
private readonly ISomeDependency _dependency;<br/>
<br/>
public MyFunctions(ISomeDependency dependency)<br/>
{<br/>
_dependency = dependency;<br/>
}<br/>
<br/>
public Task DoStuffAsync([QueueTrigger("queue")] string message)<br/>
{<br/>
Console.WriteLine("Injected dependency: {0}", _dependency);<br/>
<br/>
return Task.FromResult(true);<br/>
}<br/>
}<br/>
<br/>
```</t>