For those who haven’t heard of the Managed Extensibility Framework (MEF), a CodePlex project, there is a good episode of .NetRocks with Glen Block to explain it.
When I first heard about this provider framework, I said like many others no doubt, “Hey – I wrote an extensibility framework like that back when... I wish I had it then.” The framework that I wrote was a very flexible SOA prototype when the buzz word was SOA and nothing else. The components could be written, configured in a SQL Server catalog, enabled, data gets served, services gets oriented. In ten minutes or less, about the time to wait for a Starbucks coffee, you could code a new component and have it configured and running in the system. It’s downside was that it wasn’t schema driven so you got your work done, but some critics would say that it didn't following a schema driven, version nightmare system that takes the rest of your man-month to do right. Now we have a nice alternative - the MEF.
The MEF system uses the term, “Part” for an entity that exports or imports services. I’m very impressed with the MEF because it handles so many aspects of an extensible application that costs every innovative organization too much time and money.
Some out of the box features for the MEF include the following items.
· Optional Directory Watcher for New Assemblies
· Locking the Collection of “Parts”
· Caching Parts for Repeated Usage
· Export Parts for and Import Parts for Consummation
· Automatic Import Variable Setting
· Hierarchical Composition of Parts
MEF includes a few samples:
MEFlook - Outlook like client
MEFTris - Tetris like game with shapes as plug-ins
Extensible File Explorer - File explorer with extensible views, favorites file viewers and shell services
What application should use MEF? Paint.Net? Reflector?
Check it out if you have a need for a flexible provider system.