Tech Off Post

Single Post Permalink

View Thread: Handling Multiple Instances of Module with MEF
  • User profile image

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

    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

    How can I handle this situation?


    Any help ideas are greatly appreciated.