In CSLA v 4.5 the method Save is no longer overridable. How can I run some logic before the actual Save takes place? Specifically I need to check a permission for which I cannot use the Authorization rules.
As more and more code makes it into async/await and asyncronicity the method to override is:
protected async virtual System.Threading.Tasks.Task<T> SaveAsync(bool forceUpdate, object userState, bool isSync)
this method will be called for both sync and async code.
public T Save() { try { return SaveAsync(false, null, true).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 0) throw ex.InnerExceptions[0]; else throw; } }
Copyright (c) Marimer LLC