CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Problem with async/await

rated by 0 users
Answered (Verified) This post has 1 verified answer | 4 Replies | 2 Followers

Top 500 Contributor
15 Posts
chrduf posted on Wed, Aug 1 2012 5:20 PM

I am having troubles with an awaitable function within a DataPortal_Fetch operation. The fetch returns immediately and does not do the rest of operations after the Await. If I take the awaitable function out the operation succeeds. I am using 4.5.1.

 

 

 

 

 

 

 

 

public static async Task<CustomerEntity> GetCustomerAsync(Guid id)
{
   
return await DataPortal.FetchAsync<CustomerEntity>(
       
new SingleCriteria<CustomerEntity, Guid>(id));
}

protected async Task DataPortal_Fetch(SingleCriteria<CustomerEntity, Guid> criteria)
{
   
await Task.Delay(2000);

    // do some work - doesn't get here
}

 

Answered (Verified) Verified Answer

Top 10 Contributor
9,270 Posts
Verified by chrduf

Are you using the current code in svn? That's the only code that supports your scenario at this point.

Rocky

All Replies

Top 10 Contributor
629 Posts

Why would you want to introduce an asynchronous operation to a dataportal method?

 

Top 500 Contributor
15 Posts

I am calling another business object to get some data that may only have an async operation to fetch the data.

Top 10 Contributor
9,270 Posts
Verified by chrduf

Are you using the current code in svn? That's the only code that supports your scenario at this point.

Rocky

Top 500 Contributor
15 Posts

No I am not. I am using the 4.5.1 alfa version

Page 1 of 1 (5 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems