Asynchronous BeginFetch an Csla 4.5.10

Asynchronous BeginFetch an Csla 4.5.10

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


neo_u posted on Saturday, January 26, 2013

Hi. I just figured out that BeginFetch is not asynchronous in Csla 4.5.

I'm using .net 4.0 and before I updated to the Csla 4.5 everything worked fine, but right now all calles become synchronous and it's a huge problem.

How can I get back to work BeginFetch as asynchornous method?

 

I'm using WPF windows application, .net framework 4.0 Client Profile. 

Thanks in advance.

 

PS: I tried to read books but there are no information about this issue.

 

tiago replied on Saturday, January 26, 2013

Hi neo_u

Porting a WPF application from Csla 4.1 to Csla 4.5 should be straightforward: add a reference to Async Targeting Pack. The easiest way is to use NuGet. Have a look at How to install the Async Targeting Pack?

neo_u replied on Saturday, January 26, 2013

Hm...

Maybe I'm doing something wrong, or I need to do something more except adding Async Targeting Pack.

Because right now nothing changed BeginFetch still synced.

RockfordLhotka replied on Saturday, February 02, 2013

In the current 4.5 implementation, when using the local data portal the async methods don't automatically spin the work onto a background thread.

That will change in an upcoming release, because I solicited feedback on this implementation and most people feel that the local data portal should emulate the remote data portal. That will add extra overhead in some cases (because CSLA will always do the work on a background thread), but it will make the local and remote data portal behaviors the same.

In the meantime, you can make your DataPortal_XYZ methods return async Task, and inside your method you can use Task.StartNew to make the work occur on your own background thread.

neo_u replied on Saturday, February 02, 2013

Thanks.

I'll do like you suggesting.

 

PS: Waiting for the CSLA with async local dataportal :)

Copyright (c) Marimer LLC