Friday, June 11, 2010 12:47 AM
Hi! My team(3 developers) will be building a Silverlight LOB application. This is the first Silverlight project for us. We've been doing mostly Winforms. We'll be using Silverlight4 / VS2010 / possibly WCF RIA Services, and ASP.NET Web application to handle authentication and host the silverlight pages.
We need a way to..
- Modularize the silverlight project so we can work in different parts of the application, then integrate them.
- Dynamically load different parts of the application, so the initial download size of the xap file wouldn't be too large.
After some research, I found out that Prism and MEF are possible solutions to these goals. Can you give me advice on which framework to use? or possibly another solution? We don't have much experience on Silverlight and the project needs to be finished in 3 months, so the learning curves for frameworks should be considered. I've read some articles comparing them such as http://codebetter.com/blogs/glenn.block/archive/2009/12/02/mef-and-prism-to-be-or-not-to-be.aspx, but it's not clear to me.
Thank you for reading! Any inputs will be much appreciated.
Friday, June 11, 2010 3:14 AM
In my opinion MEF is a good solution to modularize things. it's learning curve isn't too flat.
So, I suggest you to have a look at http://live.visitmix.com/MIX10/Sessions/CL52 to make an opinion. Hope it helps.
btw prism is about MVVM that is about sepatarion of concerns and not modularity.
Hope it helps.
Friday, June 11, 2010 5:32 AM
The two aren't necessarily mutually exclusive.
Remember, Prism is guidance for building composite applications. Part of that guidance includes the concept of modules, regions, etc. The latest Prism actually builds on top of MEF, so the two are not different. The fact that Prism provides a reference application doesn't make it a "true" framework as it supplies bits and pieces you can use but the intent is as guidelines and best practices, not an actual framework to stand your application against.
I would suggest at looking to MEF as an "out of the box" framework to compose your applications. It will certainly help with the modularization and certainly the dynamic loading. You can look to Prism to pick up things like command implementations, messaging, perhaps even the newer MVVM reference implementation for that piece.
You are going to have a learning curve regardless of how you tackle modularity and dynamic loading in Silverlight, so your best strategy is going to be to minimize the risk by using something consistent and stable that has a body of information out there for learning, and I'd say MEF fits that bill nicely. The large body of information on Prism is really around the pre-4.0 releases and Silverlight 3, we are only on the first "alpha" drop for 4.0, while MEF is part of the stable runtime release.
Saturday, June 12, 2010 1:59 PM
You are going to have a learning curve regardless of how you tackle modularity and dynamic loading in Silverlight, so your best strategy is going to be to minimize the risk by using something consistent and stable that has a body of information out there for learning, and I'd say MEF fits that bill nicely.
I have to agree (again) with Jeremy on this. MEF is probably going to be "the standard way" to dynamically load Silverlight applications. So if you go MEF and have problems you will be able to find help :)
I also feel that it actually is LESS code for the same power than doing it manually, and I have done it manually for years.
If you want a down and dirty, "just tell me how to load a .xap" see:
If you want to know WHY MEF is so great at doing this see:
Saturday, June 12, 2010 10:36 PM
So MEF it is. Thank you all for great advices.
Sunday, June 13, 2010 7:23 AM
Sorry for some imprecisions I wrote about prism...I should have known it better :P
Sunday, June 13, 2010 1:22 PM
As Jeremy said, you definitely don't have to choose. Prism pieces can easily be meshed with MEF (or not). Prism v4 is actually looking at supporting MEF out of the box.
MEF provides out of the box alot of fundmentals for building composite apps. Prism adds a lot Composite UI specifics as well as plenty of samples and guidance.
You have a range of options depending on your need. You can cherry pick pieces from Prism as well such as the EventAggregator and RegionManager and use them with MEF. For example here is a post on using Prism's events with MEF for cross-part communication. http://codebetter.com/blogs/glenn.block/archive/2009/02/23/event-aggregation-with-mef-with-and-without-eventaggregator.aspx
I'd also recommend checking out the new Prism Quickstart for V4 which illustrations MEF and Prism working together. http://compositewpf.codeplex.com/releases/view/46407
Monday, December 13, 2010 6:56 AM
I believe PRISM is a really good framework when building modular applications. MEF is more difficult to understand, but with the PRISM 4 release, it fits well in Prism!
http://www.prismforsilverlight.com is a very good place to start!
Monday, December 13, 2010 7:03 AM
Here's a link to a sample that will get you started building modular apps using Prism 4 and using MEF.
Thursday, February 10, 2011 4:42 PM
Mef comes with Prism by default, along with Unity, if I were you I'd make the decision to use Prism and then which of Unity or Mef to use.
The fastest way into this is by installing the Prism sdk and then going into the Quickstart folder, you will see a range of quickstart projects, have a look at every single one of them, as well as reading the PDF. To be quite honest, its quite an exhilarating journey, and definately a fast-track.