Ninject vs Unity

Oct 2, 2009 at 8:21 AM


 I am currently using Ninject in one of my projects witch I might say I find incredibly useful and fast. But I a recent WPF project I choose to use Prism. As I see composite wpf prefers Unity and Object Builder I find no examples on usage with Ninject. Is there any reason for this ? How does Unity compare to Ninject, should I move to Unity ?


Oct 3, 2009 at 5:42 AM

Last benchmark I saw, Unity was faster than Ninject, but that may well have changed since then.

Prism doesn't actually require or even prefer Unity; it can work with any DI container that's got a bootstrapper; many container communities have written them for their container of choice. Prism ships with Unity out of the box simply so those who use it can have a complete working solution without having to download other stuff. It's very pluggable, however, so it shouldn't be that hard to plug in Ninject if you prefer. Have you asked on the Prism forum if anyone in the community is using it with Ninject?

Having said that, should you move to Unity? Well, the configuration API's are definitely different, but you end up in basically the same place in the end - a container you get objects out of. Choose the one that meets your needs. If Ninject does what you want, great. If you want to look at Unity instead, please do so. I don't have a whole lot of direct experience with Ninject, so I can't really say much on the comparison front. Please try it and see.



Oct 5, 2009 at 8:12 AM

Thank you for you answer Chris.