Problem with async/await

Problem with async/await

Old forum URL: forums.lhotka.net/forums/t/11513.aspx


chrduf posted on Wednesday, August 01, 2012

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
}

 

skagen00 replied on Wednesday, August 01, 2012

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

 

chrduf replied on Wednesday, August 01, 2012

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

RockfordLhotka replied on Wednesday, August 01, 2012

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

chrduf replied on Thursday, August 02, 2012

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

Copyright (c) Marimer LLC