Question

Suppose I have code like this:

container.RegisterType<IService, Implementation>(name, manager, 
    new InjectionConstructor(...));

Then I need to add InterceptionBehaviour to my registration, so it would be great if class ContainerRegistration have some method like AppendInjectionMembers(...).

So the question is: is it possible to append injectionMembers after registration? And if so, how to do that?

Was it helpful?

Solution

Thanks for all, I found the answer

container.Configure<InjectedMembers>().
    ConfigureInjectionFor<Implementation>(new InterceptionBehavior());

Another way without using obsolete class InjectedMembers:

container.RegisterType(null, typeof(Implementation), new InterceptionBehavior());

Or even using generic version (thanks to Chris Tavares) :

container.RegisterType<Implementation>(new InterceptionBehavior());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top