Hello,
I'm looking for a pattern to solve the following problem, which I imagine is common.
I am using WCF RIA Services to return multiple entities to the client, on initial load. I want both entities to load asyncrhonously, so as not to lock the UI, and I'd like to leverage RIA Services to do this.
My solution, below, seems to work. Will I run into problems/limitations with this approach? Is there a better pattern for this?
Thanks!
//create proxy to Domain Service
var proxy = new RIAService.Web.DomainContext();
//call service; fire event when Presentation entities have been returned
var loadPresentations = proxy.Load(proxy.GetPresentationsQuery());
loadPresentations.Completed += new EventHandler(loadPresentations_Completed);
//call service; fire event when Topics entities have been returned
var loadTopics = proxy.Load(proxy.GetTopicsQuery());
loadTopics.Completed += new EventHandler(loadTopics_Completed);
void loadTopics_Completed(object sender, EventArgs e)
{
//bind topic entities to XAML
}
void loadPresentations_Completed(object sender, EventArgs e)
{
//bind presentation entities to XAML
}