Best IoC framework for .Net

Go To StackoverFlow.com

7

Possible Duplicate:
Which .NET Dependency Injection frameworks are worth looking into?

Which is the best IoC among StructureMap and Ninject?

This should be merged with: Best injections frameworks

2008-09-19 07:48
by cvs
Best is REALLY relative - Scott Hanselman 2008-09-19 08:01
@ScottHanselman: worth is subjective, but it is also the most important thin - micahhoover 2014-07-08 18:42


9

Depends on the situation. For small projects where you need a simple container I'd choose Ninject. I like the fact that it's small and lean. I dislike the attribute's but there are ways around that.

For a big solution where you might need more than simple IoC i'd go with the Castle stuff. Lot's of flexibility there, you can use xml, attributes or a DSL to configure stuff, you can expand your IoC into AOP territory if you need it later.

I havn't tried structuremap yet. It seems it does a lot more than IoC. But I can't comment on it. I'd think that Ninject and Structuremap serve different purposes so it's hard to choose between the two without knowing a little bit more about the context. Better is usually a relative concept :-)

2008-09-19 07:56
by Mendelt


3

I use StructureMap so I probably think it is the best. But perhaps in future I would go for Unity since that is MS supported, which means better documentation and less dependent on the goodwill of one person allthough that person is very goodwilled. Of course I won't be changing framework just because it's nice. As long as something works I don't even upgrade.

2008-09-19 07:58
by chrissie1
I'm having trouble finding any documentation for Unity. Could someone provide a link - StriplingWarrior 2010-03-09 21:59
I've personally found Unity difficult to work with because of lack of documentation (including XML documentation, from memory) and high complexity. I don't think the "Microsoft supported" reasoning is good reasoning - Sam 2012-10-29 06:55


3

There is no best. Most of them do 90% of what you need in pretty much the same manner. In certain situations, one might be more flexible than another.

Given the choice I'd pick Windsor, if nothing else but I already know it pretty well. But I wouldn't gripe if I had to use Ninject or StructureMap. They're both good frameworks.

I know that currently Ninject is the only one that will run on Compact framework, so if that's a req. then Ninject is the way to go.

I'm a tad scared of Spring.NET, mostly because I loathe XML. But maybe it's not as bad as I think, don't flame me :)

2008-09-26 19:25
by Ben Scheirman


2

I'm going thorugh this process myself. I would recommend kicking off with ninject. Just because it is so lightweight and has a really low entry level. You can have it up and running in a matter of hours.

What you will find is that you will design your system with IoC in mind and that design will be largely the same regardless of the IoC framework you use.

Without too much re-work beyong the basic framework plumbing you should be able to swap out NInject for something like StructureMap if you want to.

Your best bet is to get going with one and see what issues you find and then decide whether an alternative would suit your needs better.

The frameworks out there do seem to be going through a dynamic period with new versions being released all over the place. And MEF, which is IoC and much more, may force further change of the landscape.

2009-03-02 21:31
by Scott McKenzie


2

autofac is a nice choice for small projects. If you want hardcore IoC + integration with whatever you can imagine, I'd recommend Spring.NET

EDIT Now that I think about it, Autofac rocks for projects of any size, whereas Spring.NET feels too enterprisey.

2009-05-07 10:25
by Anton Gogolev
Ads