Best IoC framework for .Net

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


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 :-)


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.


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 :)

链接地址: http://www.djcxy.com/p/82112.html

上一篇: C#依赖注入框架

下一篇: 最佳的IoC框架.Net