Skip to content

Instantly share code, notes, and snippets.

Last active November 15, 2017 14:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save justinyoo/7c94feb6d258c451130afaec2fd3ebee to your computer and use it in GitHub Desktop.
Azure Functions with IoC Container
public class FunctionFactory : IFunctionFactory
private readonly IContainer _container;
public FunctionFactory(RegistrationHandler handler = null)
// Create the Autofac container directly from
// Autofac container builder.
this._container = new ContainerBuilder()
public TFunction Create<TFunction>(TraceWriter log)
where TFunction : IFunction
// Resolve the function instance directly from the container.
var function = this._container.Resolve<TFunction>();
function.Log = log;
return function;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment