Managed Extensibility Framework

Managed Extensibility Framework
Managed Extensibility Framework
MEF logo
Developer(s) Microsoft
Stable release V1 in .NET Framework 4.0 / April 12, 2010; 18 months ago (2010-04-12)
Preview release V2 Preview 3 / February 27, 2011; 8 months ago (2011-02-27)
Written in .NET Languages
Type Web application framework
License Ms-PL
Website mef.codeplex.com

Managed Extensibility Framework (MEF) is a component of .NET Framework 4.0 for creating lightweight, extensible applications. It allows application developers to discover and use extensions with no configuration required. It also lets extension developers easily encapsulate code and avoid fragile hard dependencies. MEF not only allows extensions to be reused within applications, but across applications as well. MEF was introduced as a part of .NET 4.0 and Silverlight 4. It is available on CodePlex along with source and as a result can be used, albeit unsupported and with limitations, on version 3.5 of the framework.

What problems does MEF solve?

MEF presents a simple solution for the runtime extensibility problem. Until now, any application that wanted to support a plugin model needed to create its own infrastructure from scratch. Those plugins would often be application-specific and could not be reused across multiple implementations.

  • MEF provides a standard way for the host application to expose itself and consume external extensions. Extensions, by their nature, can be reused amongst different applications. However, an extension could still be implemented in a way that is application-specific. Extensions themselves can depend on one another and MEF will make sure they are wired together in the correct order (another thing you won't have to worry about).
  • MEF offers a set of discovery approaches for your application to locate and load available extensions.
  • MEF allows tagging extensions with additional metadata which facilitates rich querying and filtering

How does MEF work?

Roughly speaking, MEF's core consists of a catalog and a CompositionContainer. A catalog is responsible for discovering extensions and the container coordinates creation and satisfies dependencies.

  • MEF's first-class citizen is a ComposablePart (see Parts). A composable part offers up one or more Exports, and may also depend on one or more externally provided services or Imports. A composable part also manages an instance, which can be an object instance of a given type (it is in the default MEF implementation). MEF, however, is extensible and additional ComposablePart implementations can be provided as long as they adhere to the Import/Export contracts.
  • Exports and imports each have a Contract. Contracts are the bridge between exports and imports. An export contract can consist of further metadata that can be used to filter on its discovery. For example, it might indicate a specific capability that the export offers.
  • MEF's container interacts with Catalogs to have access to composable parts. The container itself resolves a part's dependencies and exposes Exports to the outside world. You're free to add composable part instances directly to the container if you wish.
  • A ComposablePart returned by a catalog will likely be an extension to your application. It might have Imports (dependencies) on components the host application offers, and it's likely to Export others.
  • The default MEF composable part implementation uses attribute-based metadata to declare exports and imports. This allows MEF to determine which parts, imports, and exports are available completely through discovery.

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Managed Extensions for C++ — or just Managed C++ is a now deprecated Microsoft set of deviations from C++, including grammatical and syntactic extensions, keywords and attributes, to bring the C++ syntax and language to the .NET Framework. These extensions allowed C++ code… …   Wikipedia

  • Colony Framework — Developer João Magalhães, Colony Developers and Hive Solutions Stable release 1.0.0 (May 2011) Major implementations Python, JavaScript, Ruby …   Wikipedia

  • .NET Framework — This article is about the Microsoft technology. For the Top level domain, see .net. For other uses, see .NET. .NET Framework Developer(s) Microsoft …   Wikipedia

  • .NET Framework — Для термина «.NET» см. другие значения. .NET Framework Тип Комп …   Википедия

  • .NET Compact Framework — The Microsoft .NET Compact Framework (.NET CF) is a version of the .NET Framework that is designed to run on resource constrained mobile/embedded devices such as personal digital assistants (PDAs), mobile phones, factory controllers, set top… …   Wikipedia

  • Microsoft Visual Studio — Visual Studio 2010 SP1 editing a WPF application Developer(s) …   Wikipedia

  • ASP.NET — Not to be confused with UNESCO ASPNet. ASP.NET Developer(s) Microsoft Initial release January 2002 Stable release 4.0.30319.1 (4.0) / 12 April 2010; 18 months ago (2010 04 12) …   Wikipedia

  • Windows PowerShell — Screenshot of a sample PowerShell session …   Wikipedia

  • Web Services Enhancements — (WSE) is an add on to the Microsoft .NET Framework which includes a set of classes that implement additional WS * web service specifications chiefly in areas such as security, reliable messaging, and sending attachments.[1] Web services are… …   Wikipedia

  • .NET — Dieser Artikel wurde aufgrund von inhaltlichen Mängeln auf der Qualitätssicherungsseite der Redaktion Informatik eingetragen. Dies geschieht, um die Qualität der Artikel aus dem Themengebiet Informatik auf ein akzeptables Niveau zu bringen. Hilf… …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”