protected void InvokePreOperation(PreOperationDelegate <TEntity>? @delegate, TEntity entity) { var cancelArg = new CancelEventArgs(); try { @delegate?.Invoke(entity, cancelArg); } catch { } if (cancelArg.Cancel) { throw new CanceledException("Cancelled by event"); } }
protected void InvokePreOperation <T>(PreOperationDelegate <T>? @delegate, T entity) where T : TPrimaryKeyEntity { var cancelArg = new CancelEventArgs(); try { @delegate?.Invoke(entity, cancelArg); } catch { } if (cancelArg.Cancel) { throw new CanceledException("Cancelled by event"); } }