MarimerLLC / cslaforum

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

clarification about SaveAsync() #659

Open Chicagoan2016 opened 5 years ago

Chicagoan2016 commented 5 years ago

Hi All, What is 'userState' in 'protected virtual Task SaveAsync(object userState, bool isSync)'? I am trying to override SaveAsycn() for a RootCollection.

kind regards

Version and Platform CSLA version: 4.7.100 OS: Windows, Linux, iOS, Android, etc. Platform: WinForms, WPF, ASP.NET Core, MVC, Xamarin, etc.

rockfordlhotka commented 5 years ago

The userState parameter is a standard mechanism used by many async APIs to allow the caller to pass arbitrary data through the async process. CSLA itself ignores this value entirely.

So you can pass whatever you'd like through that parameter in case you want to use it in an override of SaveAsync, and it also flows into the virtual OnSaved method and the Saved event (via its args).