In my mind, XAF programming model and the usage of ViewControllers in particular leans heavily toward the synchronous side of the synchronous-asynchronous spectrum.
This manifests in ViewControllers only offering non-Task returning virtual base methods as well as IObjectSpace
(Specifically the SecuredEFCoreObjectSpace
) not offering a way to CommitChangesAsync (and not invoking DbContext.SaveChangesAsync).
Considering that the rest of the dotnet world is steadily moving toward the async programming model and most libraries only offering async methods (Mediatr comes to mind), I always find myself having to fit a square peg in a round hole, coming that much closer to running into deadlocks or program crashes.
I implemented my own IAsyncObjectSpace
, SecuredEfCoreObjectSpaceAsync
, BlazorModificationsControllerAsync
, etc. that I have been able to get away with with several manageable downsides.
Questions:
- What is the recommended way to handle async operations in ViewControllers?
- What is the rationale behind keeping things synchronous?
Thanks!
- Petre
Please answer