A sample Silverlight business application using MEF, MVVM Light, and WCF RIA Services.
MEF Programming Guide
- Hosting MEF in an application
- Defining Parts and Contracts
- Declaring Exports
- Declaring Imports
- Lazy Imports
- Exports and Metadata
- Using Catalogs
- Filtered Catalogs
- Part Lifetime
- Querying the Composition Container
- Composition Batch
- Debugging and Diagnostics
- Hosting MEF in Silverlight using CompositionInitializer
- Overriding the default host configuration
- Dynamic Instantiation and ExportFactory<T>
- Application partitioning with DeploymentCatalog
MEF has shipped with Silverlight 4 and with .NET Framework 4.0 and there are versions on CodePlex targeting Silverlight 3 and .NET Framework V3.5 Sp1.
If you’re looking to get started with MEF then here’s some quick resources;
- Glenn Block’s new MSDN Magazine Overview Article and Glenn’s Blog
- The Overview on CodePlex
- The Programming Guide on CodePlex
- Mike Taulty’s Channel 9 Videos
but if you’re already up and running then want to know what’s new in the latest drop for the Silverlight developer?
- Updated samples!
- Renaming and changes to PartInitializer
- Renaming and moving of PartCreator
- Renaming and changes to CompositionHost.InitializeContainer
- A new DeploymentCatalog class, suport dynamically asyn load XAP files on demand!!!
MEF is a framework that simplifies the design of extensible applications and components. It can flexibly and dynamically discover a set of loosely coupled components and analyse their dependencies in order to compose them together at run time.
Mike Taulty has recently put up a six part series of screencasts covering the use of MEF in Silverlight 4.
Another screencast showing how to create a singleton plug-in service shared by a 2 instances of non-shared plug-in.
What Is The Difference Between an IoC Container and MEF?
MEF allows you to write your application as a series of much simpler mini applications, and have those brought together to create a much great whole
IoC container = service level components, MEF = Autonomous Components. A MEF "part" will probably use an IoC container
I recommend reading them highly, they will do a much better job than I could at explaining the detail of the decision points, Should I use MEF for my general IoC needs? and Should I use MEF with an IoC container?
Watch this first: 10mins Screencast
In Silverlight 4 – Glenn Block
- PDC09 – Building Extensible RIAs with Managed Extensibility Framework
- MEF has landed in Silverlight 4. We come in the name of extensibility
- Building Hello MEF Part 1
- Creating the rule Interface : IRule
- Creating a rule instance
- Creating the holder for all your plug-ins
- Creating the logic to load the plugin
- Load Rules at runtime
Also from codeplex: