Over a million developers have joined DZone.

Spring.NET Superiority Over MS Unity and Ninject

·
I'm evaluating .NET-related technologies for the purpose of my latest project (desktop application for processing radiological and pathological images). Today I played with MS Unity and Ninject.

I was quite surprised that either MS Unity nor Ninject are unable to handle bi-directional references, like these:
class A
{
   B B { get; set; }
}

class B 
{
   A A { get; set; }
}
Both MS Unity and Ninject enter infinite loop (create default constructor and set a break point there).

Spring.NET resolves dependencies without any problems. A huge plus for Spring.NET.

cheers,
Łukasz

p.s.
In case someone would argue why I use bi-directional references: it's a desktop application where implementing MVC/MVP requires view to have a reference to controller/presenter and controller/presenter to have a reference to view.

p.s.2
I used latest versions of Unity and Ninject available in NuGet.

Topics:

Published at DZone with permission of Łukasz Budnik, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}