Configuring Unity Container with Service that calls WCF service?

Topics: Prism v4 - Silverlight 4
Dec 1, 2010 at 9:15 AM

I have a prism 4 application that registers types within the application container. When one of the services is instantiated I need to call a WCF service that retrieves some data before the application can continue. Here is the scenario. Application starts -> types are registered in container -> module downloaded -> two data binding to view model -> within view model get service instance -> ask for data. The problem is how do I stop the UI from hanging whilst I wait for the data from the service.

The reason I need this is the service checks to see if there is any saved data on the server to 'pre-fill' the form with data. If I can't call the service this way, can I call the service from application start-up; I tried this too within configure container but again the application hung. I tried to use a ManualResetEvent.



Dec 1, 2010 at 5:51 PM

Hi Ron,

WCF Service calls in Silverlight have to be done in an asynchronous manner. You might also find this blog post from Matias Bonaventura useful, as it deals with this scenario. Although it is targeted at an older release of Prism, the approach is still valid.

You could also find information about this in the MVVM Reference Implementation.

As an additional note, you could find WCF Ria Services useful for your scenario, which simplifies communication between the presentation tier and the mid-tier.

I hope you find this helpful.

Guido Leandro Maliandi