Managed Extensibility Framework

Krzysztof recently announced on his blog that we have begun working on an extensibility framework for .NET..


We will blog more details about MEF in the upcoming months, but here are some early details (subject to changes, of course): MEF is a set of features referred in the academic community and in the industry as a Naming and Activation Service (returns an object given a “name”), Dependency Injection (DI) framework, and a Structural Type System (duck typing). These technologies (and other like System.AddIn) together are intended to enable the world of what we call Open and Dynamic Applications, i.e. make it easier and cheaper to build extensible applications and extensions.


And finally here is some code showing basic scenarios our framework supports:

Creating an Extension Point in an Application:

public class HelloWorld {

  [Import] // import declares what a component needs
  public OutputDevice Output;

  public void SayIt() {
        Output.WriteLine("Hello World");

// Extension 
public abstract class OutputDevice {
  void WriteLine(string output){}

1. Creating an Extension

[Export(typeof(OutputDevice))] // export declared what a component gives
public class CustomOutput : OutputDevice {
  public void WriteLine(string output) {


2. Magic that makes composes (DIs) the application with the extensions.

var domain = new ComponentDomain();
var hello = new HelloWorld();

// of course this can be implicit
domain.AddComponent(new CustomOutput());
domain.Bind(); // bind matches the needs to gives

We'd love to hear what you think.. please join the discussion on Kry's blog.

Comments (4)

  1. 【原文地址】 Managed Extensibility Framework 【原文发表日期】 28 April 08 06:14 Krzysztof 最近在他的blog上宣布 ,我们已经开始致力于为

  2. boo says:

    what’s the meaning of DIs? thank you!

  3. Daniel says:

    Is this related to Unity at all?  If so, how?  If not, why not? =)

Skip to main content