This project has moved and is read-only. For the latest updates, please go here.

Manage Multiple Instances of a module in MEF

Jun 15, 2012 at 4:31 PM

We are desinging an LOB application using Silverlgiht 5 ,PRISM 4.1 and MEF as prism's container.

Note: We thought that we could load a module morethan once before we actually realized that we cannot.

Issue is

We desinged a  NewOrders module whichc will take New orders. This module Shell has a TabControl with TabItems as SearchCustomerView,CustomerInfoEnter View,CheckCustomersCreditHistory etc.. and all these have their own viewmodels with partcreation policy for views and viewmodels are default Shared. CustomerInofEnterViewModel has a Import of ISearchCustomerViewModel, which uses Customerobject(on SearchCustomerViewmodel) if he was found on search screen to fill its screen to save a service call and similarly CheckCustomerCreditHistory uses Customer object on CustomerInforEnterViewmodel to run the check.

Now that we have requirement of User can place multiple orders? which means we have to create multiple instances on NewOrders Module.

So we decided to make all views and viewmodels partCreation policy as NonShared ,So all imports have new instances, so SearchCustomerView code behind has a import of IsearchCustomerViewmodel and CustomerInfoViewmodel has a import of SearchCustomerViewmodel and both are diffrent and i cannot share information accross other viewmodel's


Any help ideas are greatly appreciated.