Skip to content

Instantly share code, notes, and snippets.

@CarlosLanderas
Last active February 3, 2017 10:32
Show Gist options
  • Save CarlosLanderas/66afe2534544ed7702d7667beb4e9da4 to your computer and use it in GitHub Desktop.
Save CarlosLanderas/66afe2534544ed7702d7667beb4e9da4 to your computer and use it in GitHub Desktop.
Delegate Autofac Register
builder.Register<SingleInstanceFactory>(ctx =>
{
var c = ctx.Resolve<IComponentContext>();
return t =>
{
object o;
return c.TryResolve(t, out o) ? o : null;
};
});
public delegate object SingleInstanceFactory(Type serviceType);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment