开发者

MAF vs. MEF vs. Prism

I was watching some tutorials for MEF or Prism with Silverlight but was also doing some MAF work (System.AddIn) on the side and thought that might work also. I see that Prism and MEF are pr开发者_如何学Goetty much the same thing but Prism having the event aggregator.

Does anybody have thoughts on how well MAF works with Silverlight?


Similar post... Choosing between MEF and MAF (System.AddIn)

As for MEF vs. PRISM, the differences extend beyond the existence of the Event Aggregator - specifically Extensibility, Discovery, and different concepts of Modularity. At this point, these are somewhat complimentary products. The June 1 drop of PRISM 4 supports MEF (instead of Unity) as a DI container. Glenn has a nice explanation of MEF here.


So MEF is not the same thing as PRISM. Prism is a UI composition framework, which can be used with WPF, Silverlight, WP7, Surface, and probably with C# based Metro Style Apps for Win8. On the other hand, MEF is a general component composition framework, and acts as a robust dependency injection solution. By composition I mean it can discover your components in runtime and wire up them together. MEF is particularly useful with its recomposition feature - basically the system can change its behavior in runtime. Imagine dropping a new dll into app's bin folder, that dll is immediately picked up and new functionality shows up!

When it comes to Silverlight, MEF works there like a charm! You can have prism modules loaded by MEF. Finally, MEF for SL comes with DeploymentCatalog - it allows you to download additional XAPs in runtime, and assuming you leverage the recomposition feature, you can add new functionality for the app as the user works with the app, thus you can conserve bandwidth on the app startup as you don't have to download everything at once.

So summing up, MEF works great with SL, and also with Prism. Highly recommended tandem!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜