I'm hoping somebody can give me some guidance on consuming ADO.NET Data Services within a Prism application. Specifically, I'm building a Silverlight app using the framework.
My plan is to create a Service item in my module that will act as a wrapper for the calls to ADO.NET Data Services via LINQ queries. To illustrate, it would be like implementing a more realistic version of the GetPriceHistory() method in the MarketHistoryService
in the StockTraderRI application, in which the method would actually call through to the database via ADO.NET Data Services.
Now, my questions arise when I consider the fact that the call to the data service will be executed asynchronously, probably using the BeginExecute() method of a DataServiceQuery object - the typical pattern used for Silverlight-to-DataServices. Assuming I'm
doing things right up to this point, how do I setup my interaction between my UI/presenter and the GetPriceHistory method to deal with the new asynchronous nature of the query?
Should I change my GetPriceHistory method to accept a callback method?
Maybe add an event that fires-off when the query is complete?
Or should I handle the async stuff internally and force GetPriceHistory to mimic a blocking method while it "polls" for the query to finish and return?
Surely somebody has already come up with a "best practice" for this, seemingly typical, scenario.