比较 Castle Windsor、Unity 和 StructureMap [英] Comparing Castle Windsor, Unity and StructureMap

查看:43
本文介绍了比较 Castle Windsor、Unity 和 StructureMap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在对 Krzysztof 的声明的跟进中,Windsor 比其他 IoC 做得更多,我想了解这些 IoC 是如何与之抗衡的彼此以及温莎城堡提供的好处/额外设施.

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 提供而其他容器不提供的任何重要功能.温莎StructureMapSpring.NET 都已经存在好几年了并且被大量使用这些年来的项目,所以他们现在非常成熟.较新的容器,例如 AutofacUnityNinjectSimpleInjector 以之前的经验为基础,因此它们也不会缺少那些重要的功能.

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 和/或代码注册(它还具有 流畅的 API 就像现在的大多数容器一样.

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.

整合:温莎拥有大量设施(模块)允许与其他框架/库轻松集成.其他集成包括 ASP.NET MVCMonoRail, 工作流基础NServiceBus, MassTransitRhino 服务总线Quartz.Net, Solr网络SolrSharpWindows 传真服务.

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

这篇关于比较 Castle Windsor、Unity 和 StructureMap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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