Need guidance in Integrating ADO.Net DataServices with PRISM

Topics: Prism v2 - Silverlight 3
May 9, 2010 at 6:37 PM
Edited May 11, 2010 at 6:47 AM


I have developed a application in silverlight using Prism framework. As per the help docs I have created the functionality as Interfaces/Services which are coded in the Module application. Using events I then trigger these functions from the View Model.

   I have used ADO.Net data services in the Service class. from the view model I must call this service function with a return type of Action delegate. Sinec in the service layer the functionality is done in a asynchronous mode, i am not able to integrate the event with the function in service coded using ADo.Net data services.

Need a demo / sample code/ guidance  on achieving the same.

Thanks in advance.



May 12, 2010 at 9:01 PM

Hi Sharanth,

If I understand correctly your scenario is the following:

  1. An event is published using EventAggregator at a certain point in your application.
  2. A ViewModel is subscribed and handles the event.
  3. In the handler, you make a call to a WCF (ADO.Net) DataService.

However, from the explanation above I am not certain where the issues lays. Therefore, I will provide a general explanation of how this can be achieved (at least the way I would do it).

  1. In the handler, I would make the call to the WCF DataService, providing a callback method inside that same ViewModel.
  2. In the callback, I would add the information obtained from the service call to a ViewModel bindable property. For example, if you received a list of Customers, add them to an ObservableCollection<Customer>.

That will automatically update the UI bound to the Customer collection.

This video shows a similar usage scenario (it does not use MVVM, but it does use bindings). You might also find this blog post by Matias Bonaventura useful, as it deals with issues when using WCF services in Prism applications and could provide valuable information.

Please let me know if this helps.

Damian Schenkelman