NET的最佳IoC框架 [英] Best IoC framework for .Net

查看:50
本文介绍了NET的最佳IoC框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
哪些.NET依赖注入框架值得研究?

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

在StructureMap和Ninject中,哪个IoC最好?

Which is the best IoC among StructureMap and Ninject?

这应该与以下内容合并:最佳注入框架

This should be merged with: Best injections frameworks

推荐答案

取决于情况.对于需要简单容器的小型项目,我选择Ninject.我喜欢这样的事实,它既小又瘦.我不喜欢该属性,但是有很多解决方法.

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.

对于一个大型解决方案,您可能需要比简单的IoC还要多的东西,我会选择Castle的东西.那里有很大的灵活性,您可以使用xml,属性或DSL来配置内容,如果以后需要,可以将IoC扩展到AOP领域.

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.

我还没有尝试过Structuremap.似乎它做得比IoC还要多.但我无法对此发表评论.我认为Ninject和Structuremap具有不同的用途,因此在不了解上下文的情况下很难在两者之间进行选择.更好的通常是一个相对的概念:-)

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

这篇关于NET的最佳IoC框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆