问题描述
在后续中,一个href =http://www.castleproject.org/container/index.html =noreferrer> Windsor 比其他IoC还要好多了,我想了解这些IoC如何与每个其他和Windsor城堡提供的优惠/附加设施。
In a follow up to Krzysztof’s statement that Windsor does a lot more than other IoC’s, I wanted to understand how these IoC’s stack up against each other and the benefits/additional facilities that castle Windsor provides.
有没有比较?有人可以帮助我了解Castle Windsor提供的其他功能,其他IoC的
Are there any comparisons? Can someone help me understand the additional features that Castle Windsor provides over other IoC’s
推荐答案
请参阅和对几个IoC容器进行了彻底的技术比较,尽管现在有些过时了(他们来自Windsor 2.0之前)
See here and here for a pretty thorough technical comparison of several IoC containers, although somewhat outdated by now (they're from before Windsor 2.0)
然而,我认为Windsor提供的其他容器并不具有任何真正的功能。 ,,已经存在了好几年了,并已被大量使用这些年来的项目已经非常成熟了。较新的容器,例如,,和基于以前的经验,所以他们也不会缺乏这些重要的功能。
However, I don't think there are really any vital features that Windsor offers and other containers don't. Windsor, StructureMap, Spring.NET have all been around for several years and have been used in lots of projects over these years so they're very mature now. Newer containers, like Autofac, Unity, Ninject and SimpleInjector build on that previous experience so they won't lack those vital features either.
现在答案的主观部分更为主观:我喜欢认为Windsor具有可用性,可扩展性和集成模块的完美结合。
Now the more subjective part of the answer: I like to think that Windsor has a nice mix of usability, extensibility and integration modules.
可用性:例如,您可以使用XML和/或代码注册(它也有一个,像现在的大多数容器一样)。
Usability: for example, you can use XML and/or code registration (it also has a fluent API like most containers nowadays).
可扩展性:,您可以使用定制或覆盖任何默认行为。
Extensibility: Lots of extension points that you can use to customize or override pretty much any default behavior.
集成:Windsor拥有(模块),允许轻松与其他框架/库集成。其他集成包括,,,,,, ,,,。
Integration: Windsor has lots of facilities (modules) that allow for easy integration with other frameworks/libraries. Other integrations include ASP.NET MVC, MonoRail, Workflow Foundation, NServiceBus, MassTransit, Rhino Service Bus, Quartz.Net, SolrNet, SolrSharp, Windows Fax Services.
涵盖了Windsor的许多优点和扩展点。
This series of articles covers many niceties and extension points of Windsor.
请注意,我不是说其他容器不提供类似的东西!即使你选择了其中一个,后来发现它缺乏一些集成,通常不难自己编码。
Note that I'm not saying that other containers don't offer similar things! Even if you picked one of them and later you found out it's lacking some integration, it's usually not hard to code it yourself.
底线 :只要您正确地构建代码(例如避免服务定位器反模式),我不认为任何主要的IoC容器可能会出错。
Bottom line: I don't think you can go wrong with any of the main IoC containers, as long as you structure your code properly (e.g. avoid the service locator anti-pattern).
这篇关于比较城堡温莎,Unity和StructureMap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!