Microsoft's Managed Extensibility Framework (MEF) is an open source (MS-PL) .NET application composition framework available on CodePlex. MEF provides aspects of a plug-in model and an inversion of control container.
MEF is currently under development, still in in alpha, but its goal is to enable greater reuse of applications and components. The idea is to shift an application from being "statically compiled to dynamically composed." Traditional inversion of control containers are used with an inward focus on well-defined needs, e.g., this class needs a logger and transaction context. MEF is more similar to a plug-in provider, with an external focus on exposing extensibility points.
MEF Source Code Preview 4 is now available for download. Preview 4 release notes:
- Diagnostics improvements - More information is provided in error messages when a composition error occurs.
- Lifetime (creation) Policy improvements - Importers can request a specific creation policy for an injected object. Non-disposable non-shared objects will now be garbage collected before the container is disposed, fixing a bug that held onto them indefinitely.
- AllowNonPublicCompositionAttribute removed - Private and internal members will now always be injected.
- Namespace cleanup - Two new namespaces have been added under System.ComponentModel.Composition: .Hosting and .Primitives. "Hosting contains types commonly used only by host applications, such as ExportProvider, CompositionContainer and the catalogs. Primitives contains types for implementing a custom programming model, such as ComposablePart, ImportDefinition and ExportDefinition."
- Type name cleanup - many type names have been shortened, resulting breaking changes:
- ComposablePartCatalog and related types were moved from System.ComponentModel.Composition to System.ComponentModel.Compositioni.Primitives.
- AttributedTypesPartCatalog was renamed to TypeCatalog
- AttributedAssemblyPartCatalog was renamed to AssemblyCatalog
- DirectoryPartCatalog was renamed to DirectoryCatalog
- AggregatingComposablePartCatalog was renamed to AggregateCatalog
- Catalog Caching extensibility API’s have been made internal.
- Sample applications have been updated:
- Meflook - Outlook like client
- Meftris - Tetris like game with shapes as plug-ins.
- Extensible File Explorer - File explorer with extensible views, favories file viewers and shell services
Managed Extensibility Framework requires .NET Framework 3.5 and Visual Studio 2008 for development.