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