Esempio n. 1
0
        public void AddUnitOfWorkScope(string key, UnitOfWorkScope unit)
        {
            if (_unitOfWorkScopes.ContainsKey(key))
            {
                return;
            }

            _unitOfWorkScopes.Add(key, unit);
        }
Esempio n. 2
0
        public UnitOfWork(UnitOfWorkScopeType scopeType)
        {
            _preCommitActions = new List<Action>();

            switch (scopeType)
            {
                case UnitOfWorkScopeType.New:
                    _transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                    _unitOfWorkScope = new UnitOfWorkScope(scopeType);
                    break;
                default:
                    _transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                    _unitOfWorkScope = UnitOfWorkManager.Instance.CurrentUnitOfWorkScope ?? new UnitOfWorkScope(scopeType);
                    break;
            }
            _unitOfWorkScope.Units.Add(this);
        }
Esempio n. 3
0
        public UnitOfWork(UnitOfWorkScopeType scopeType)
        {
            _preCommitActions = new List <Action>();

            switch (scopeType)
            {
            case UnitOfWorkScopeType.New:
                _transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                _unitOfWorkScope  = new UnitOfWorkScope(scopeType);
                break;

            default:
                _transactionScope = new TransactionScope(TransactionScopeOption.RequiresNew);
                _unitOfWorkScope  = UnitOfWorkManager.Instance.CurrentUnitOfWorkScope ?? new UnitOfWorkScope(scopeType);
                break;
            }
            _unitOfWorkScope.Units.Add(this);
        }
Esempio n. 4
0
        public void AddUnitOfWorkScope(string key, UnitOfWorkScope unit)
        {
            if (_unitOfWorkScopes.ContainsKey(key)) return;

            _unitOfWorkScopes.Add(key, unit);
        }