views:

41

answers:

2

Im trying to determine if MEF (from codeplex) is right for my needs. I know MEF supports on-demand loading of Xap files. But does anybody know if it supports on-demand loading of silverlight libraries (dll's)?

Thanks.

+2  A: 

The DeploymentCatalog makes it easy to download a XAP file. We don't have built in functionality to help downloading a DLL directly, but if you download it yourself and load it as an assembly (ie with Assembly.Load), you can use an AssemblyCatalog to create a catalog for that assembly that you can use with MEF.

Daniel Plaisted
So if I want to load modules (sections of code based on user's authorization), then i would need to create a Xap for each module? then, via on-demand loading, load the relevant Xap files and subsequently load the assemby(ies) from it?
AlvinfromDiaspar
@Alvin You could do that, or you could write your own code to download the DLLs, and when it was done load them and put them in an AssemblyCatalog. But putting each module in a separate XAP is probably better.
Daniel Plaisted
A: 

Here's a modified version of the DeploymentCatalog that allows you to download either DLLs or XAPs.

http://pietschsoft.com/post/2010/10/22/Silverlight-Modify-MEF-to-load-plugins-from-DLL-and-XAP-files.aspx

This was so simple to add, it's a wonder why they didn't add it in the first place.

Chris Pietschmann