Thursday, May 28, 2009

Getting MEF’ed in 20’ish lines of code - A short and code focused MEF introduction

Malisa Ncube - Managed Extensibility Framework 101 - (a)

“This is the first posting on MEF that precedes a number of them, in which I will be explaining some things that I discovered while playing around with MEF. I should say that all the postings on my blog, including this subject do not represent my employer or any other organization, they are merely my mumblings based on my work that I do and whatever in find interesting and would like to share. Use it at your own risk, but it works on my machine.

To start with I would like you to read about the architecture of the MEF framework from the MEF Codeplex site.

In my MEF101, I present an example which shows how you can import composable parts from your assemble and let MEF compose and satisfy imports and enable you to come up with a simple interface made from different parts.

image

…”

MEF is something we’ll be hearing more and more about in the coming months and years (if you haven’t been hearing about it already). The beauty is in MEF’s simplicity which I thought this post highlighted well.

While MAF is much more powerful, it can be serious overkill too (in both learning curve and complexity). MEF fits great into that initial slot, where you don’t need the power, flexibility and isolation that MAF provides, yet still want a composable/plug-in’able application. And since Visual Studio is taking a dependency on MEF, it’s not likely to go away in the near future…

Also check out Kathleen Dollard's (who’s doing some great MEF work) related post, Leaning Into Windows - MEF and MAF Resources.

 

Related Past Post XRef:
The Redmond Developer & Kathleen Dollard get MEF’ed with VB
Managed Extensibility Framework (MEF) CTP2 Released – Now with the full source
The Managed Extensibility Framework (MEF) CTP Released (Not to be confused with the Managed Addin Framework [MAF] which became System.Addin)

No comments: