-
-
Save justinyoo/f36bed04c7203e2aacd6c4f15a5048c1 to your computer and use it in GitHub Desktop.
Make Your Azure WebJobs Testable Again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AutofacJobHostBuilder : JobHostBuilder | |
{ | |
public AutofacJobHostBuilder(IModule module) | |
: this(GetJobHostConfigurationBuilder(module)) | |
{ | |
} | |
public AutofacJobHostBuilder(IJobHostConfigurationBuilder config) | |
: base(config) | |
{ | |
} | |
private static JobHostConfigurationBuilder GetJobHostConfigurationBuilder(IModule module) | |
{ | |
var handler = new AutofacRegistrationHandler() { RegisterModule = p => p.RegisterModule(module) }; | |
var activator = new AutofacJobActivator().RegisterDependencies(handler); | |
var builder = new JobHostConfigurationBuilder(activator); | |
return builder; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment