Using MEF

To use MEF, you need to add the following two assemblies to your project:

  • System.ComponentModel.Composition.dll
  • System.ComponentModel.Composition.Initialization.dll

The first assembly is the key MEF assembly, and the second adds additional Silverlight-specific features to MEF. Let's look at how you go about using MEF in your Silverlight application.

Key Steps in the Composition Process

The following three steps are key in the composition process with MEF:

  • Export parts
  • Import parts
  • Compose the parts together

You export parts, import them, and then compose them. When you think of MEF in these terms, you can really start to see how simple it is. Let's look at each of these steps in more depth.

Exporting Parts

You can export a class ...

Get Pro Business Applications with Silverlight 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.