Unity: registering a decorator in a child container?

You can use named mapping: parentContainer. RegisterType("decorated"); childContainer. RegisterType( new InjectionConstructor(new ResolvedParameter("decorated"))) This way the registration of the decorator depends on the named mapping "decorated" of the interface IFoo.

You can use named mapping: parentContainer. RegisterType("decorated"); childContainer. RegisterType( new InjectionConstructor(new ResolvedParameter("decorated"))); This way the registration of the decorator depends on the named mapping "decorated" of the interface IFoo.

Yeah, that's actually what I'm currently doing, but I don't like this solution very much, since now I have to either manually register every type that uses IFoo, or make sure to register IFoo in every child container, even if it doesn't need to override the default behaviour. – Doron Yaacoby Apr 18 at 9:37 You could register IFoo in the parent container twice with the same mapping: a named registration and a default one. – onof Apr 18 at 11:10 Yep, again a solution I've used, but seems a bit funky.

I guess there just isn't any other way now. Thanks – Doron Yaacoby Apr 20 at 5:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions