The project descripton...

Oct 19, 2010 at 6:29 PM
Edited Oct 19, 2010 at 7:43 PM

... is that meaningless I wish Marlon you would change that please.

For me and all other people out there I ask you to describe the advantages using  MEFedMVVM versus MVVM only apps.

"Library for building MEF MVVM applications for Silverlight and WPF. By using this library you can easily build MVVM application."

I haven`t fully understood the aim of MEFedMVVM only that it is injecting services automatically which could make MEFedMVVM look like a DI tool replacement,

but I think thats is not right.

Oct 20, 2010 at 12:11 AM

MVVM is a design pattern.  To use it in Silverlight or WPF you need to have a way of creating a view-model and assigning it to your view's DataContext.  You can obviously do this yourself, but it's very dull and boring, so most people rely on a framework to do this bit.

Now view-models will normally have some dependencies.  Best practice is to use DI and let some form of container manage these ... there are many containers that can do this, one of which is MEF.

So if you're looking for an MVVM framework for WPF or Silverlight which uses MEF as the DI container, then you're at the right place and MEFedMVVM can do the job for you.  If you're looking for a general purpose DI container or and IOC or an MVVM framework which uses some other container, then you'll need to continue looking.

HTH,
John 

Coordinator
Oct 20, 2010 at 9:09 AM

the best thing to do to get a better idea of MEFedMVVM is to read this article

http://marlongrech.wordpress.com/2010/05/23/mefedmvvm-v1-0-explained/

 

It goes through the features of MEFedMVVM 

Oct 20, 2010 at 9:11 AM

quote:"...So if you're looking for an MVVM framework for WPF or Silverlight which uses MEF as the DI container..."

well its not that boring its done in 5 minutes ;-) But to make things clear, MEFedMVVM is NO MVVM framework, because you wrote that. There is a lot missing to make MEFedMVVM a MVVM framework, but as I said

that wasn`t the purpose of the author Marlon.  I am using MVVM Light Toolkit and wanted now to use LightCore as DI tool => http://lightcore.ch/en/default.aspx

 

So... should I kick LightCore when I want to use MEFedMVVM ? Afair  MEF is not a DI tool its a extensible plugin framework.

Oct 21, 2010 at 12:34 AM

I am using MEFedMVVM with Sacha Barber's Cinch V2 and would call the combination of both a MVVM framework based on MEF.

MEF creates my views and, via MEFedMVVM, my view models, so one can call it a CO (Creator of Objects) instead of DI tool or plugin framework, if one wishes. 

If you follow some history through Marlon's posts, its initial intention was to be a full-fledged MVVM framework. Later he decided it would better be a utility library that can support any MVVM framework that wants MEF and other services that it provides. In fact, I don't even use its DelegateCommand implementation but rather use Cinch's SimpleCommand.

Oct 21, 2010 at 7:14 PM
Edited Oct 21, 2010 at 7:19 PM

Thanks Tonko for the answer, it helped a bit to understand more. But still I ask myself when Mefedmvvm is creating the viewModel AND thus do the service injection via constructor, do I need a DI tool like Unity, LightCore etc???

Normally a DI tool resolves the service and you get the concrete class to access methods. Is Mefedmvvm doing that?

An answer would be helpful.

Oct 21, 2010 at 10:52 PM

Bastien,

You don't need DI tool in this scenario since MEF provides similar functionality (accent on similar, not identical in all respects).

It would be incorrect to say that MEFedMVVM itself resolves services but MEF does. In my case I use MEFedMVVM and Cinch services and my ViewModel importing constructor looks like:

        [ImportingConstructor] 

       public MyViewModel(

            IViewAwareStatus viewAwareStatusService, 

           IUIVisualizerServiceEx uiVisualizer, 

           IMessageBoxService messageBoxService, 

           IMyDataModel modelInterface    )        

{

..

}

MEFedMVVM creates MyViewModel and MEF takes care of the rest thanks to [ImportingConstructor] attribute and the fact that all the services are MEF-exported (so they can be imported/concrete class instantiated).

 

Oct 22, 2010 at 3:35 PM
Edited Oct 22, 2010 at 9:47 PM

ok Tonko now I think I could use MeFeedMVVM :)

Coordinator
Oct 23, 2010 at 12:04 PM

Thanks Tonko for replying... BastienPascal sorry if I am late in the game here but lately I was super mega busy

Oct 23, 2010 at 11:49 PM

Hey marlon,

no biggy as long you check my other thread ;-)

Mar 29, 2011 at 6:52 PM

again me... still some doubts came up so I have to ask again:

What If I have ViewModels which wrap models, so the ViewModels can`t/aren´t created automatically by MEFedMVVM. I do create them. The contructor of the ViewModel takes as parameter serveral service instances.

My question is now can MEFedMVVM somehow do sort of

MEFedMVVMService.GetService<IMyService>() ?