Friday, May 14, 2010

MEF’ing in VB and SilverLight 4, with a little MVVM thrown in for flavor, from Glenn Block

Glenn Block - Hello MEF in Silverlight 4 and VB! (with an MVVM Light cameo)

“For a while we’ve been getting a number of requests to have some MEF samples in VB. Let me first apologize as it’s been something I’ve been meaning to do for a very long time. To partially redeem myself, I’ve gone ahead and ported my Hello MEF sample which I demonstrated at PDC and had a small blog series on. BTW, I won’t blame you if you are not ready to forgive me for not showing VB love earlier. ;-)

The “app” (If you squint you might think it’s a real app :-) ) is an illustration of building a pluggable dashboard with MEF. The sample illustrates a ton of concepts around MEF, but the app itself is quite simple to grock.

  • How to declare exports and imports
  • How to import collections
  • How to lazily instantiate parts
  • How to create custom MEF export attributes
  • How to use MEF metadata for self-describing your MEF components and how you access it.
  • How to use MEF from within XAML (i.e. imports satisfied on parts that are created by the xaml partser).
  • How to apply the View Model (my shorthand for MVVM)  pattern with MEF
  • How to partition you MEF applications across multiple XAPs
  • How to override the default MEF configuration.
  • How to use MVVM Light’s RelayCommand for simple commanding.

And much much more:

I warn though that I am going to be moving pretty fast, so hold on tight!

image …”

MEF = Cool

VB = Cool

MEF + VB = Cool Cool! :p

 

Related Past Post XRef:
The Redmond Developer & Kathleen Dollard get MEF’ed with VB

SilverLight 4, RIA Services, MEF and MVVM, oh my… A four part series from the mind of Shawn Wildermuth (updated for VS2010/SL4 RTM)
10 MEF’Tastic reasons to use MEF – If you’re writing your own “plugin” framework, stop now and check out MEF now (you won’t likely be sorry)
Coding plugin support into your app, because coding is for fun!
Plug into MEF in 10 minutes or less
Best of UK MSDN Flash 2009 eBook
Bart’s Beautiful and Benevolent Personally Guided, “from the Why to the How,” Tour of MEF – The 30+ page tome edition (aka INSERT MEF.* INTO Your.Brain)
Fan (i.e. someone not on the team) MEF Tutorial and Hands On Lab
Getting MEF’ed in 20’ish lines of code - A short and code focused MEF introduction
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: