开发者

MEF and Autofac in Silverlight 4 App

Just started working on a composite App that will multi-target WPF & Silverlight 4. It's quite likely that we'll allow some 3rd party plugins. Also, we'd like to partition the Silverlight app into multiple XAPs that can be independently downloaded/loaded.

We had thought that using MEF to control the Extension points (i.e. module composition) of the app and Autofac to handle dependencies within modules would be the way to go.

Here's the rub, though. Autofac doesn't appear to have SL4 MEF integration, so we can't simply register types from catalogs in the Silverlight code. Since we're using XAPs to partition the app, we need to use the MEF DeploymentCatalog to pull the new XAPs in as they download. We had considered simply registering types into Autofac (mostly views & viewmodels) by assembly, but 开发者_如何学Pythonthere doesn't appear to be a way to get at the assemblies via the DeploymentCatalog. Are we missing something? Is there a way to get at the assemblies in the DeploymentCatalog after it downloads? Are we looking at this in the wrong way?

Feel free to ask for more detail if this isn't sufficient. Any help is always much appreciated.

Cheers,

Steve


If you're hitting friction here, I'd say your best bet is to embrace either MEF or Autofac 100%.

The integration between the two works well for simple plug-in scenarios, but the MEF features that are appealing in Silverlight stem from MEF's "light up" capabilities, which Autofac does not support.

Hope this helps,

Nick


What about not registering types in Autofac? What I'm thinking is that, very much like the Resolve Anything approach, you could make a registration source that mediates resolve requests to the "back-end" deployment catalog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜