I need to translate the following Unity snippet to Autofac implementation:
container.RegisterType<IMyThing>(
new TransientLifetimeManager(),
new InjectionFactory(c => c.Resolve<IMyThingProvider>().GetTheThing()));
What's the equivalent of InjectionFactory ?
I believe you want to use a lambda registration :
container.Register(ctxt => ctxt.Resolve<IMyThingProvider>().GetTheThing())
.As<IMyThing>();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.