Microsoft Silverlight Optimization and Extensibility with MEF
Wouldn't it be nice if your team could add new features to your applications without all the headache they have to deal with today? With the Managed Extensiblity Framework (MEF) in 4.0 you can bolt your apps together dynamically on the fly. Adding new modules and features is as simple as deploying a new binary, you don't have to touch the existing code. You can even deploy those features as separate XAP files which can be loaded on-demand! Come to this talk for a quick tour of what MEF is, and learn how you can use it to beat out your competition.
- Tags: Silverlight

12 Comments
IgorM said
Mar 19 2010
Where can the sample code can be found? I'd like to play with the Mike Taulty's sample
Glenn Block said
Mar 19 2010
Hi Igor
The code for my demos including the modified version of Mike's sample are located here: http://cid-f8b2fd72406fb218.skydrive.live.com/self.aspx/blog/MIX%202010%20Demos.zip
The demo that I couldn't get to work is in the MefDemo_Extensible folder.
Cheers
Scott Sean said
Mar 25 2010
An excellent MEF Primer Glenn - thanks a lot.
I have 3 main questions if I may:
1) In my application I would like to allow 'customers / third parties' to extend my application by allowing them to 'pligin / inject' there own custom parts onto my page (i.e. the parts are not separate pages). My application uses ASP.Net MVC v2 - are the same principles / patterns that you describe in your presentation relevant to MVC? Do you have any good examples / sites / docs that demonstrate its use in MVC?
2) I might be wrong but your demo showed plugins being added that weren't connected to each other, i.e. a change (an event) in one plugin did not affect the behaviour of another plugin. In my application, as I have already described, I would like the parts to be panes on the same page with the 'plugin parts' (the extensions) listening to events published by the 'out-of-the-box parts'. Is this possible, if so, do you have any good examples / sites / docs that demonstrate?
3) In the past I have used Prism with Silverlight and WPF - can you explain what the differences are between Prism and MEF?
Thanks
Scott
krishna deepak said
May 20 2010
I am using MefNavigation as shown above.Its working fine for me until Reports Xap load. Now, I want to navigate pages in loaded Xap (i.e., reports xap). How can i navigate??
Thanks,
Deepak.k
Glenn Block said
May 29 2010
Krishna
If you use my content loader, then all pages must be exported through MEF in order for them to be found. Are the other pages in the XAP that you want to navigate through all using the Page attribute?
Amit said
Jun 22 2010
MEF Is stil a baby in front of prism.
I hate to say that because I've invested my 4 weeks in MEF and then I've realised that we cannot do this:
http://forums.silverlight.net/forums/t/187939.aspx
Chris said
Jun 28 2010
I wish you would have put that into Unity. :-)
David said
Jul 9 2010
Glenn, is the sample code you posted under MS-PL?
said
Jul 17 2010
[[url=http://www.fivefingerssupply.com/][b]vibram five[/b][/url]
[url=http://www.fivefingerssupply.com/][b]vibram five fingers[/b][/url]
[url=http://www.fivefingerssupply.com/][b]vibram shoes[/b][/url]
[url=http://www.fivefingerssupply.com/][b]fivefingers[/b][/url]
[url=http://www.fivefingerssupply.com/][b]vibram fivefingers[/b][/url]
[url=http://www.fivefingerssupply.com/][b]five fingers shoes[/b][/url]
[url=http://www.fivefingerssupply.com/][b]fivefingers vibram[/b][/url]
[url=http://www.fivefingerssupply.com/][b]five fingers vibram[/b][/url]
[url=http://www.fivefingerssupply.com/][b]five fingers vibram sale[/b][/url]
[url=http://www.fivefingerssupply.com/][b]five fingers vibram uk[/b][/url]
[url=http://www.fivefingerssupply.com/][b]five fingers[/b][/url]
[url=http://www.fivefingerssupply.com/][b]vibram five fingers sale[/b][/url]
[url=http://www.fivefingerssupply.com/][b]vibram bikila[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-classic-c-2.html][b]Vibram five fingers Classic[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-classic-c-2.html][b]Vibram five fingers Classic Sale[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint women[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint mens[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint sale[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram kso[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]five fingers kso[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso sale[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso women's[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso mens[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso black[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram five fingers kso trek sale[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram five fingers kso trek[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram kso trek[/b][/url]
[url=http://www.fivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram trek[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram fingers[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram five[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram five fingers[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram shoes[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]fivefingers[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]fivefingers vibram[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]five fingers vibram[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]five fingers vibram sale[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]five fingers vibram uk[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]five fingers[/b][/url]
[url=http://www.vibramfivefingerssupply.com/][b]vibram five fingers sale[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-classic-c-2.html][b]Vibram five fingers Classic[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint women[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint mens[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-sprint-c-3.html][b]vibram five fingers sprint sale[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso sale[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso women's[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso mens[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso black[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram five fingers kso trek sale[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-c-1.html][b]vibram kso[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram five fingers kso trek[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram kso trek[/b][/url]
[url=http://www.vibramfivefingerssupply.com/vibram-five-fingers-kso-trek-c-4.html][b]vibram trek[/b][/url]
Geek said
6 days ago
Your example works great. However if i use it in my project i get an error on the function EndLoad (ContentLoaderBase)
Error: "The container has already been initialized either by another call to InitializeContainer or by someone causing the default container to be constructed. Ensure that InitializeContainer is one of the first things that happens in the application host to ensure that it is ready for the first composition."
If i then disable DeploymentCatalogService.Initialize() in my App.xaml.vb then i get the error "The sequence does not contain an agreeing element."
The Page i try to call is declared like this:
Partial Public Class MyAccount
Inherits Page
...
End Class
And the link is defined as:
Im really going nuts on this.
Hope you can help me out
Geek said
6 days ago
args seems the hyperlinkButton definition dissapeard.
so here are its attributes:
NavigateUri="/MyAccount" mef:MEFContentLoader.Xap="User.Extensions.xap" TargetName="ContentFrame"
Geek said
5 days ago
Ok i found out that i have also to export the pages in the main app.
But now im facing a really big problem...
I have included deep linking into my application but the contentloader seems not to like it.
Defined the uri mapper:
uriMapper:UriMapping Uri="/MyAccount/{id}" MappedUri="/MyAccount?userID={id}"
HyperlinkButton:
HyperlinkButton x:Name="Link3" NavigateUri="/MyAccount/123" mef:ContentLoader.Xap="User.Extensions.xap" TargetName="ContentFrame"
It seems the MyAccount page dont get added to the PageFactories unless i change the NavigateUri to MyAccount?userID=1234
But there goes the idea of deep linking :(
Any help would be nice.
Content="UserAcount"