示例#1
0
        public LockUnitOfWorkScope(object syncRoot, IUnitOfWorkScopeProvider unitOfWorkScopeProvider)
        {
            #region Contracts

            if (syncRoot == null) throw new ArgumentNullException();
            if (unitOfWorkScopeProvider == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            _syncRoot = syncRoot;

            // Enter
            try
            {
                // Monitor
                Monitor.Enter(_syncRoot);

                // UnitOfWorkScope
                _unitOfWorkScope = unitOfWorkScopeProvider.Create();
                if (_unitOfWorkScope == null) throw new InvalidOperationException();
            }
            catch
            {
                // Dispose
                this.Dispose();

                // Throw
                throw;
            }
        }
        public LockUnitOfWorkScopeProvider(object syncRoot, IUnitOfWorkScopeProvider unitOfWorkScopeProvider)
        {
            #region Contracts

            if (syncRoot == null) throw new ArgumentNullException();
            if (unitOfWorkScopeProvider == null) throw new ArgumentNullException();

            #endregion

            // Arguments
            _syncRoot = syncRoot;
            _unitOfWorkScopeProvider = unitOfWorkScopeProvider;
        }
示例#3
0
        public LockUnitOfWorkScopeProvider(object syncRoot, IUnitOfWorkScopeProvider unitOfWorkScopeProvider)
        {
            #region Contracts

            if (syncRoot == null)
            {
                throw new ArgumentNullException();
            }
            if (unitOfWorkScopeProvider == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            _syncRoot = syncRoot;
            _unitOfWorkScopeProvider = unitOfWorkScopeProvider;
        }
示例#4
0
        public LockUnitOfWorkScope(object syncRoot, IUnitOfWorkScopeProvider unitOfWorkScopeProvider)
        {
            #region Contracts

            if (syncRoot == null)
            {
                throw new ArgumentNullException();
            }
            if (unitOfWorkScopeProvider == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            // Arguments
            _syncRoot = syncRoot;

            // Enter
            try
            {
                // Monitor
                Monitor.Enter(_syncRoot);

                // UnitOfWorkScope
                _unitOfWorkScope = unitOfWorkScopeProvider.Create();
                if (_unitOfWorkScope == null)
                {
                    throw new InvalidOperationException();
                }
            }
            catch
            {
                // Dispose
                this.Dispose();

                // Throw
                throw;
            }
        }
示例#5
0
 // Constructors
 public LockUnitOfWorkScopeProvider(IUnitOfWorkScopeProvider unitOfWorkScopeProvider) : this(new object(), unitOfWorkScopeProvider)
 {
 }
 // Constructors
 public LockUnitOfWorkScopeProvider(IUnitOfWorkScopeProvider unitOfWorkScopeProvider)
     : this(new object(), unitOfWorkScopeProvider)
 {
 }