1 year ago

#340696

test-img

helaj80024

How to do something with the parameter used in creating a new instance in AutoFac?

I am looking to do something like this: (Free handed)

 container.RegisterType<MyParam>().InstancePerDependency();
 container.RegisterType<MyType>().WithParameter<MyParam>((ctx, myParam, newInstance) => { 
     ctx.Resolve<SomeOtherType>().Bind(myParam, newInstance);
 });

Is it possible to do with Autofac?

c#

dependency-injection

autofac

0 Answers

Your Answer

Accepted video resources