Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

.net - Is MEF a dependency injection framework?

The recently announced managed extensibility framework (MEF) of .NET 4.0 - is it a dependency injection framework? Will Microsoft Unity from Patterns and Practices be obsolete in 4.0 ? How does MEF compare to a framework like Unity?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Specifically addressed in the PDC 2008 2nd Keynote by Scott Guthrie, MEF has a lot more to do with things like extending Visual Studio 2008 and other applications, without having to use all the COM and older technologies... A very good demonstration of extending the text edition in VS2008 was shown among other things. Start about an hour and 15 minutes into the 2nd day keynote (http://www.microsoftpdc.com) and you'll get direct information, but basically if you are going to "build an application with built in extensiblity points that can easily be discovered, and which supports discovery of extensions," then MEF is what you want. UNITY is what you want for a high-quality IoC container that does DI as well as the other solutions out there but has great and easy integration with the Enterprise Library.

Regarding Unity in the EL4.0 (now 4.1 -- http://msdn.microsoft.com/en-us/library/dd203099.aspx) its actually a IoC that sits on top of the version 2 ObjectBuilder and the EL4.1 has extensibility points for unifying the configuration of various EL application blocks with Unity.

MEF vs. Unity is like comparing apples to oranges. Some great and specific podcast/webcast(s) that describe UNITY in full are here, which I highly recommend:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...