Decisions of affairs with delegates in unity

With Unity, since February 2011, improved this delegate story to achieve parity with StructureMap?

+6
source share
1 answer

Yes. In fact, it comes with Unity 1.0 as an extension for the factory's injections, so the blog post is wrong about the possibilities not exist.

In Unity 2.0, the story has become much simpler. You can do:

container.RegisterType<IWhatever>( new InjectionFactory(container => whateverFunctionYouWant())); 

This leads to temporary registration; You can use any life time manager you want.

+9
source

Source: https://habr.com/ru/post/918034/


All Articles