Ninject VS团结的DI [英] Ninject vs Unity for DI

查看:105
本文介绍了Ninject VS团结的DI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用ASP.net MVC。

We are using ASP.net MVC.

哪一个是最好的DI框架Ninject或Unity为什么?

Which of these is the best DI framework Ninject or Unity and why?

推荐答案

最后一次我看到在其中任何一个,我发现Ninject略胜一筹。但都有其缺点。

Last time I looked at either of them I found Ninject slightly better. But both have their drawbacks.

Ninject有一个更好的流畅配置方案。团结似乎主要依赖于XML配置。 Ninject的主要缺点是,它需要你到处引用Ninject.Core在code以添加[注入]属性。

Ninject has a better fluent-configuration scheme. Unity seems to rely mostly on XML configuration. Ninject's main drawback is that it requires you to reference Ninject.Core everywhere in your code to add [Inject] attributes.

如果我可能会问,为什么你限制你的选择,这两个?我认为Castle.Windsor,Autofac和StructureMap至少一样好或更好。

If I may ask, why are you limiting your choices to these two? I think Castle.Windsor, Autofac and StructureMap are at least as good or better.

这篇关于Ninject VS团结的DI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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