We have a command BO in Silverlight that is configured to RunLocal, and the actions within this command are asynchronous.
We do this because we're calling out to a third party with a fair amount of network traffic and processing involved, and we wanted the client to shoulder the burden rather than have the web server shoulder the burden.
At present, it doesn't look like there is a place with the refactored dataportal to allow this to happen. The pre CSLA 4.5 code looks like this:
public void DataPortal_Execute(Csla.DataPortalClient.LocalProxy<OurCommandObjectType>.CompletedHandler handler)
{
// Call a third party asynchronously,
// invoking handler when completed.
}
Any suggestions?
By the way, it was great seeing you give the keynote yesterday. You're always a great speaker to come and see.
You should be able to mark the data portal method as async. For example:
[RunLocal]
private async Task DataPortal_Fetch()
{
// use await keyword in here
}
You will need to learn the task parallel library patterns used to wrap "old style" async code, because most of the existing SL APIs use the older callback handler model.
Copyright (c) Marimer LLC