MEF Preview 6 out the door

During my tow week vacation the MEF team shipped a Preview 6. The team has posted all the facts and changes in this preview release so I won’t reiterate in detail but rather link to their posts on the subject.

However; before I do that here are a few comments from me on the release:

First comment: Congratulations! The release is looking good as usual!

Second comment: I know for a fact that MEF has bounced about a bit within the Microsoft organization. It has to support this. It has to integrate with that. It should be organized under foo and not bar. Working under shifting organizational climates can be a challenge and still the team seems to successfully adapt and push out a continued great product. You Rock AND Rule!

rock_rulemed[1]

Now for the content comments:

Silverlight support for Silverlight 3: This just shows the awesomeness of MEF having no dependencies on (almost) anything else. This is a core framework piece that may be used by anyone to solve the extensibility challenge without having to take any other heavy dependencies.

Lazy<T> is a cooler sounding name than Export<T>: The class is used to get a reference to a part and access it’s metadata Lazy<T, TMetadata> without necessarily having to instantiate the part. You can decide in your code when the required import gets created using this little baby – which is handy in most cases but absolutely required in others. See below.

There used to be an ExportCollection<T>. This is now replaced with the use of an ImportManyAttribute coupled with the use of an enumeration of T [ImportMany] IEnumerable<T> {get;set;}. The usage here (to continue from above) is that you can lazily import a set of T’s and instantiate only the one you wanted. I remember at a time that I looked at the implementation of the old ExportCollection and found it really shallow. It didn’t really contain much. All the magic happened in the old Export<T>. Good thing this behavior changed.

InheritedExportAttribute: Inheritance and MEF exports has proven to be a tough nut to crack. I’ve fallen into the earlier preview caveats myself and now in Preview 6 the behavior changes again. Look at the blog post below by Nicholas to read the details on how to handle MEF exports and inheritance.

Attributes are now unsealed and may be subclassed: We are approaching release and now the team feels comfortable with unsealing some of the core attributes in MEF: ExportAttribute, ImportAttribute, ImportManyAttribute and ImportingConstructor may now all be subclassed to add your own custom behavior to these little babies. Cool and useful but here be dragons! It is easy to go wrong when you change and modify the intended behavior of a framework. If you can handle the power you can do cool things. But only do this if you really know what you’re doing and be sure the modifications have a clear and good value!

That which the team calls Stable Composition is very handy and useful for missing dependencies in exports and debugging and such. I recon a lot of work has gone into fixing the debugging story from feedback from early adopters. Now you can Dump Composition State in order to get a readable version of the state of composition within your app. Nice!

All in all> loving the new release and now I get to download it and update all my pet projects from Preview 5 to Preview 6… WooHoo! ;~)

Here is the MEF site for the download of MEF Preview 6.

Here are the related posts by the MEF PMs:

Glenn Block: http://blogs.msdn.com/gblock/archive/2009/07/18/mef-and-xaml-integration-self-composition.aspx

Nicholas Blumhart: http://blogs.msdn.com/nblumhardt/archive/2009/07/09/mef-preview-6-available.aspx

Cheers,

M.

Technorati Tags: ,
This work is licensed under a Creative Commons license.

posted @ Monday, July 20, 2009 9:13 AM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 1 and 4 and type the answer here:
 

Live Comment Preview: