English 中文(简体)
MEF 是一个依赖注入框架吗?
原标题:
  • 时间:2008-11-15 21:06:41
  •  标签:

最近宣布的.NET 4.0的托管可扩展框架(MEF)是依赖注入框架吗? Patterns and Practices的Microsoft Unity将在4.0中过时吗? MEF如何与Unity这样的框架相比较?

最佳回答

特别是在Scott Guthrie的PDC 2008第二场主题演讲中提到,MEF有很多与扩展Visual Studio 2008和其他应用程序等相关的工作要做,而不需要使用所有的COM和旧技术...其中包括扩展VS2008的文本编辑功能等。从第二天的主题演讲开始约1小时15分钟(http://www.microsoftpdc.com),您将获得直接的信息,但基本上如果您要“构建一个具有嵌入式可扩展性点的应用程序,这些点可以轻松地被发现,并且支持扩展的发现”,那么MEF就是您需要的。UNITY是一个高质量的IoC容器,它可以像其他解决方案一样进行DI,但是与企业库的集成非常方便和优秀。

关于 EL4.0 中的 Unity(现在是 4.1-http://msdn.microsoft.com/en-us/library/dd203099.aspx ),它实际上是一个 IoC,位于版本 2 的 ObjectBuilder 之上,EL4.1 具有可扩展性点,用于将各种 EL 应用程序块的配置与 Unity 统一。

MEF 和 Unity 的比较就像是苹果和橙子的比较。这里有一些介绍 UNITY 的出色而具体的播客/网络广播,我强烈推荐:

DotNetRocks Show #393 http://www.dotnetrocks.com/default.aspx?showNum=393 DNR.tv Show #126 http://www.dnrtv.com/default.aspx?showNum=126

问题回答

I saw one write up that made it sound like one but more information (Scott Guthrie at PDC2008[Video/wmv]) made me think it s more than a dependency injection framework. From the sounds of things it can be used for dependency injection but also does more.

我发现这篇关于MEF/MAF/Unity/Prism的讨论非常有启发性。点此查看讨论内容

I would like to add one mopre line which I have just read that MEF is not a part of Inversion of Control(as dependecny is said to be synonym of IOC) but it implements it. When we implement IOC via dependency injections we generally use Unity, which helps in discovering static dependencies but MEF allows us to increase the extensibility of our application without configuring the components statically, even they can be discovered at run time. There are other links as well which can help you more: Difference between Unity and MEF





相关问题
热门标签