.NET Zone is brought to you in partnership with:

Łukasz works as a Technical Architect for an international IT company and is responsible for delivering applications written in Java EE, Spring, and .NET. He has been involved in many various projects ranging from online insurance systems, voice and video solutions, mobile systems (both native and HTML5-based), medical systems, and large system integration projects. Łukasz is an expert in distributed systems, SOA, and cloud. Łukasz holds PhD in Computer Science. Łukasz is a DZone MVB and is not an employee of DZone and has posted 20 posts at DZone. You can read more from them at their website. View Full User Profile

Spring.NET Superiority Over MS Unity and Ninject

06.10.2012
| 6271 views |
  • submit to reddit
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.

Published at DZone with permission of Łukasz Budnik, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)