예제 #1
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;

            var disposeExceptions = new List <Exception>();

            foreach (var transactionFeature in _transactionFeatures.Values)
            {
                try
                {
                    transactionFeature.Dispose();
                }
                catch (Exception ex)
                {
                    disposeExceptions.Add(ex);
                }
            }

            if (disposeExceptions.Count > 0)
            {
                throw new AggregateException(disposeExceptions);
            }

            DisposeHandler.Invoke(this, this);
        }
예제 #2
0
        public void OnDispose(DisposeHandler handler)
        {
            var myAction = new MyAction(handler);

            if (Interlocked.CompareExchange(ref disposeAction, myAction, null) != null)
            {
                throw new InvalidOperationException();
            }
        }
예제 #3
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                throw new InvalidOperationException("this unit of work is already dispose");
            }

            IsDisposed = true;

            DisposeHandler?.Invoke(this, this);

            _parentUow = null;
        }
예제 #4
0
 public MyAction(DisposeHandler dispose)
 {
     Dispose = dispose;
 }