Home  /  Questions  /  Question

88   96.5
Jun 22, 2010

What are Structure Map and Spring.Net?

What are the differences between Structure Map and Spring.Net? Why they are used? Are these new patterns?  

As far as I understand  these are IOC(Inversion of Control) and use DI (Dependency Injection) with xml-based configuration files. Enterprise Library 1.1 is using DI, Plugin, and Factory Method, based on an xml configuration file (Configuraton Context etc...).
What is the difference between the two? Which one should I use?  I am confused and need some kind of a roadmap.
Thank you.
If you're interested in a dependeny injector, I'd recommend you take a look at Ninject (http://ninject.org). It doesn't use any Xml for its configuration, and it is easy to get started with. --- Robert Blixt  Jun 27, 2010
I'd also give LightCore a try... it's like the name suggests a light weight DI container that's still sort of feature rich. ;-) The website is in german, I believe, but I am sure, you will find the code interesting (http://lightcore.peterbucher.ch/) --- Christian Jacob  Jul 01, 2010

555   99.9
Jun 24, 2010
What I don't understand is, you obviously seem to know the buzzwords (StructureMap, Spring.NET, Enterprise Library, Inversion of Control, Dependency Injection, etc...). Why are you not able to put the pieces together on your own?

To sum it up a little:
  • Both StructureMap and Spring.Net are Frameworks as well as the Enterprise Library is
  • StructureMap is known as the oldest IoC Container offering Dependency Injection for .NET based development
  • Spring.Net is a framework that is supposed to make life as a developer easier (containing features like e.g. object relational mapping through NHibernate, better Databinding and Validation for ASP.NE, Remoting, UnitTesting and more. Amongst those features, you can find the Spring.Net Core which is essentially its own IoC Container.
  • Enterprise Library is a library of modules based on best practices featured by Microsoft. It has a lot of so called Application Blocks (Validation for example) and further more uses Unity as a base for its own IoC Container.
Dependency Injection and Inversion of Control are pattern that allow you decouple your concrete implementation of some functionality from the logic of your code. By configuration through an xml file or even dynamically at runtime, you can decide which concrete implementation of an interface you are going to work with.

Hope that helps.
 1 comment
Thanks Chris, I am new to this and studying about these subjects. It gave me a general overview about the subject. --- Volkan Genç  Jun 24, 2010