Silverlight and multi xaps.

Nov 6, 2009 at 5:12 AM

Hi,

I failed to find any tutorial how you deal with multi xap silverlight application.

For example I've got a view interface IShoppingCartView and need to get its implementation that is in ShoppingModule.xap.

Thanks,

Alexey.

Developer
Nov 6, 2009 at 6:06 PM

We don't really have any support for Multi-XAP applications in the core of MEF. We do have a PictureViewer sample that builds a PackageCatalog that it uses to load other XAPs, perhaps you can have a look at it.

Nov 6, 2009 at 10:16 PM
We are planning to ship a package loader class (similar to the one in the PictureViewer) as part of the Silverlight toolkit, which will be announced soon. Long term we'd like to have proper support in MEF.
Glenn

From: weshaggard [notifications@codeplex.com]
Sent: Friday, November 06, 2009 10:06 AM
To: Glenn Block
Subject: Re: Silverlight and multi xaps. [MEF:74283]

From: weshaggard

We don't really have any support for Multi-XAP applications in the core of MEF. We do have a PictureViewer sample that builds a PackageCatalog that it uses to load other XAPs, perhaps you can have a look at it.

Nov 7, 2009 at 8:35 AM

Hi Glenn,

Since we are using multi xap scenario from the first steps with Silverlight I would like to remark main features that it should support.

1. Multi xaps should share common dlls. Currently we are creating all xap via cached dll option and than while parsing xap manifest dowload assemblies zips by hand. Without this feature using of multi xap is useless. Example: You've got a Grid.dll (1Mb) and you are using grid in 3 of 5 modules. So only first grid depended module should load that dll.

2. The second main problems is style sharing. I've already blogged about it (http://weblogs.asp.net/alexeyzakharov/archive/2009/10/14/issues-of-silverlight-style-system.aspx). Currently we solve it by our custom lazy style loader (if style related dll is not loaded skip it and try next time). I hope that next Silverlight version will care about it itself.

PS: We have already created one project on our own framework which work in multi xap scenario. You can check it here: househotel74.ru.

Best regards,

Alexey Zakharov.

Nov 7, 2009 at 8:40 AM

=) Have you ever thought about some kind of lazy dependency injection container which cares about all this multi xaps?

container.Register<IFooInterface>(FooClassStringName,FooXapRef) =) The bad guy here is string representation of type.. but we don't know anything about it.

Nov 11, 2009 at 7:41 AM

Actually, MEF is inherently lazy to the core so it supports this. You can build a custom catalog that has a manifest (or downloads one from the server) that indicates which exports reside in each XAP. Then it could download those catalogs in an on-demand fashion.

Register is the enemy of MEF :-)