public ChildUnitOfWork([NotNull] IUnitOfWork parent) { Check.NotNull(parent, nameof(parent)); _parent = parent; _parent.Failed += (sender, args) => { Failed.InvokeSafely(sender, args); }; _parent.Disposed += (sender, args) => { Disposed.InvokeSafely(sender, args); }; }
public virtual void Dispose() { if (IsDisposed) { return; } IsDisposed = true; if (!IsCompleted || _exception != null) { Failed.InvokeSafely(this, new UnitOfWorkFailedEventArgs(this, _exception, _isRolledback)); } OnDisposed(); }
/// <summary> /// Called to trigger <see cref="Failed"/> event. /// </summary> /// <param name="exception">Exception that cause failure</param> protected virtual void OnFailed(Exception exception) { Failed.InvokeSafely(this, new UnitOfWorkFailedEventArgs(exception)); }
protected virtual void OnFailed() { Failed.InvokeSafely(this, new UnitOfWorkFailedEventArgs(this, _exception, _isRolledback)); }