Search code examples
wpfmvvminversion-of-controlmefextensible

Using more than one IOC in WPF MVVM application


I am developing an MVVM WPF application using the MVVMlight toolkit.

It comes with the SimpleIoc container mainly for design time / runtime separation (correct me if I'm wrong).

My question is does it do anything else other than that?

I need IOC for other parts of the program and very likely I will use something like Ninject.

Also very likely to make it extensible I am going to use MEF.

Then there will be 3 independent IOC things (SimpleIoc from mvvmlight, Ninject, and MEF) in the application. Is this feasible and necessary?

Can one do the work of the other two, or I really need them three to cover different areas.

Any best practice suggestions?

Thanks in advance.


Solution

  • In your case I would use Prism. It is much more mature than MVVM light. Yes it is also bigger so if you will not be making modular app you can take only Unity IOC which is probably one of the best containers out there. If you more than one it depends on the approach to the architectural problems you take. Basically one container should be more than enough.