I currently have a Silverlight application using Prism and MEF. I connect to several WCF services in this application but use a "controller" class to hold the instantiated client-generated service proxy objects.
What I want to do is inject the service references into this controller (like I currently do with the IEventAggregator). I'm unsure how to do this. Do I need to make a wrapper class that implements the service contract interface, and holds a reference to
the service proxy object?
What I do now:
/// WCF client used to communitcate with the data WCF service
private DataClient _dataClient; // DataClient is the client generated object from a service reference
/// Region manager for the application
private IRegionManager _manager;
/// Application event aggregator
private IEventAggregator _eventAggregator;
/// Constructor. Initializes the statistics controller, hooks up all services, and initializes all commands.
/// <param name="manager"></param>
public ZOpportunityController(IRegionManager manager, IEventAggregator events)
_manager = manager;
_eventAggregator = events;
//hookup a WCF service used to retrive GP data
_dataClient = new ZellerGpDataClient();
_dataClient.OpenCompleted += new EventHandler<AsyncCompletedEventArgs>(_dataClient_openCompleted);
_dataClient.GetCustomersCompleted += new EventHandler<GetCustomersCompletedEventArgs>(_dataClient_GetCustomersCompleted);
As you can see here, I connect to a service in my controller constructor, but I'd like to just inject a new object into the controller like I do with IRegionManager and IEventAggregator, that is already wired for asynchronous communication to the service.
Can someone help me achieve this?