Len registration of dependencies with unity

Note 1: I want to make this clear: I am not trying to lazy load dependencies or introduce lazy types.

Most (all?) IoC containers require metadata to be registered in the container to describe how some type should be allowed on request; this includes the implementation of the interface, the lifetime of the object, etc. Over the past few years, most (all?) IoC containers have added weathercards / conventions based APIs that reduce noise when this metadata is provided to the container.

With ninject, I use the conventions-based approach to register my metadata, but I do this on demand, not in advance. This provides huge performance savings in a test integration scenario where you create ~ 10 objects; You lose the overhead of registering all application dependencies for each test.

Note 2: Please do not tell me that you should not use the IoC container in the integration test.

There is some pressure to move on to using Microsoft components when they are available, so Unity is on my horizon. I have a work based on conventions, but I cannot figure out how to โ€œdiscoverโ€ this metadata on demand / lazily, as I could in Ninject.

- UnityContainer, GetInstance (type) , , . , , . ; , GetInstance (type) , , .

: / Unity?

, . , , Ninject.

+3
2

- Unity , .

, , Unity .

, . , , , . ?

(Windsor) , , . , ( , , ). , . , , , - , , , , .

+5

All Articles