LocalContext is lost inside async DP methods (MVC app) #2497
-
Describe the bug It is available in a non-async method call. Version and Platform Code that Fails
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Or are you saying that there's an exception when trying to access I agree that there is different behavior between sync and async, because async is more similar (in practice) to a remote data portal call, while sync is as lightweight as possible, coincidentally running in the same context as the logical client. |
Beta Was this translation helpful? Give feedback.
-
Way too confusing if the outcome is different though. What if there's a sync dp call inside a async one? The sync one shouldn't know about the parent should it? |
Beta Was this translation helpful? Give feedback.
-
It has been this way since around 2005 😉 It will change in CSLA 6 though, because the whole way application context is managed stops being "global" and is instead an injected instance of |
Beta Was this translation helpful? Give feedback.
-
Ha ha! I wasn't doing much async programming back in 2005! Not too sure if |
Beta Was this translation helpful? Give feedback.
-
The intent of
The intent of I agree that the use of |
Beta Was this translation helpful? Give feedback.
-
That's really helpful. Up to now I've always associated |
Beta Was this translation helpful? Give feedback.
The intent of
LocalContext
is to provide a way to have global state on the client and different global state on the server, both such that the state is managed for you by CSLA, so itThe intent of
ClientContext
is to provide a way to have global state on the client, with that state flowing to the server with each data portal call, so the server has a copy of the client state.I agree that the use of
LocalContext
is quite limited, and in most casesClientContext
is what people would want to use.