DomainDataSource - MVVM and MEF

Aug 23, 2011 at 1:55 AM


I have a Silverlight 4 - MVVM project that is using MEF (no Prism) to import / inject external .xap files. So far so good... I have my large project broken up into several different projects and .xap files that contain user controls.

But now I'm puzzled; When I need data... where do I place the DomainDataSource? I'm using RIA Services and that information is located in the main project.

It would seem that I need to place it in the external projects ViewModel, but again, the external project knows nothing of the RIA Services. So, do I then place it into the main apps ViewModel? That's the page that is using MEF to load the external .xap file... It seems like it should go there. But then, how do I bind it to the incoming View that's being loaded by MEF?

Also, it seems that the external View still needs a ViewModel of it's own so I can bind the controls to properties.

Can MEFedMVVM rescue me in this kind of situation? Can someone please give me some clues? Point me to some links? Or, does anyone have an example they can share?

Anyway, any help would be greatly appreciated.

Many thanks in advance,

~ Dave Navarro