MEF with Mulitple Copies of a Service and Pub/Sub

Topics: Prism v2 - WPF 3.5, Prism v4 - WPF 4
Jan 14, 2015 at 6:46 PM
Edited Jan 14, 2015 at 6:47 PM
I am developing a desktop application in which each object has their own copy of a service. Each object has a number of views and the sevice performs an operation dependent on which view is currently selected. I use pubsub to communicate when a view has changed. The problem I am having is that the service for object 1 subscribe is being called and the sevice for object 2 subscribe is also being called when object1 publishes the event. I hope this is sufficient enough to describe the scenario.
  1. Is it good practice to have multiple copies of a service? If not, how do you handle the case where you want to track the state of two objects separately and then perform an operation on the object based on the selected state with only one copy of the service?
  2. How is pub/sub handled when you have mutiple copies of a service but only want a one-to-one response (i.e object 1 only published to the service object that is created for object one)?