MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

Async DataPortal_Insert? #484

Open ajj7060 opened 6 years ago

ajj7060 commented 6 years ago

I know you can do private Task DataPortal_Fetch(int id) and Csla will do the right thing and await the fetch method. I'm now needing to call an async method in my DataPortal_Insert, which is defined in the BusinessBase. I can't override the method to make it return Task, and if I declare it private Task DataPortal_Insert() I get a warning about needing new which makes me wonder if Csla will find the right method.

How do I correctly use async/away from with in DataPortal_Execute(), DataPortal_Insert(), and DataPortal_Update()?

rockfordlhotka commented 6 years ago

iirc you should use the new keyword and the data portal will use your async method.

dazinator commented 6 years ago

This just caught me out as well. We have style conventions that complain if Async methods don't end in the word Async. Perhaps it would be a nice idea to enable CSLA to find DataPortal_ExecuteAsync etc. For now I can simply surpress these naming style rules in a surpression file as a workaround so not a huge issue.