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

            _unitOfWorkScopes.Add(key, unit);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 4
0
        public void AddUnitOfWorkScope(string key, UnitOfWorkScope unit)
        {
            if (_unitOfWorkScopes.ContainsKey(key)) return;

            _unitOfWorkScopes.Add(key, unit);
        }