Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Losing Csla Context on continuation when async/await returns

$
0
0

I'm running into an issue where the continuation code (i.e. the code that is run when an "await" call returns) loses the CSLA contexts (ApplicationContext, GlobalContext, etc.).

Here's a pseudo example of what I'm doing (standard async/await CSLA Factory stuff). This is the calling code:

line 1: var businessObject = await BusinessLogic.MyType.GetAsync();
line 2: DoSomethingWith(businessObject); 

The MyType.GetAsync() factory implementation uses the async DataPortal, like this:

...
return await DataPortal.FetchAsync<MyType>(...);
... 

I have some values set in Csla.GlobalContext, and prior to line 1 executing, these values can be accessed. However, when the continuation returns on line 2, the Csla.GlobalContext would be empty.

Have I missed something regarding the use of CSLA with async/await when it comes to the CSLA Contexts  ? My expectation would have been that CSLA await continuations would implicitly re-apply the original context, or have I just missed something silly like a configuration option or something?

I'm using CSLA 4.5.601.

Thanks


Viewing all articles
Browse latest Browse all 764

Trending Articles