CSLA .NET

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

Asynchronous BeginFetch an Csla 4.5.10

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

Not Ranked
14 Posts
neo_u posted on Sat, Jan 26 2013 6:14 AM

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.

 

Answered (Verified) Verified Answer

Top 10 Contributor
9,270 Posts
Verified by neo_u

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.

Rocky

All Replies

Top 25 Contributor
450 Posts

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?

Tiago Freitas Leal, CslaGenFork (Open Source CSLA code generator)

Not Ranked
14 Posts
neo_u replied on Sat, Jan 26 2013 1:27 PM

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.

Top 10 Contributor
9,270 Posts
Verified by neo_u

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.

Rocky

Not Ranked
14 Posts
neo_u replied on Sat, Feb 2 2013 7:17 AM

Thanks.

I'll do like you suggesting.

 

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

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