示例#1
0
            public FakedTransaction(ICoreTransaction parent)
            {
                if (parent != null && parent.IsRolledback != null)
                {
                    throw new InvalidOperationException("The transaction can not be created because a parent transaction is rolled back. Exception:\r\n\t" + parent.IsRolledback.Message, parent.IsRolledback);
                }

                this.parent = parent;
            }
示例#2
0
            public NamedTransaction(ICoreTransaction parent, string savePointName)
            {
                if (parent == null)
                {
                    throw new InvalidOperationException("Named transactions should be nested inside another transaction");
                }

                if (parent != null && parent.IsRolledback != null)
                {
                    throw new InvalidOperationException("The transaction can not be created because a parent transaction is rolled back. Exception:\r\n\t" + parent.IsRolledback.Message, parent.IsRolledback);
                }

                this.parent        = parent;
                this.savePointName = savePointName;
            }
示例#3
0
        Transaction(Func <ICoreTransaction?, ICoreTransaction> factory)
        {
            var dic = currents.Value ??= new Dictionary <Connector, ICoreTransaction>();

            Connector bc = Connector.Current;

            if (bc == null)
            {
                throw new InvalidOperationException("ConnectionScope.Current not established. Use ConnectionScope.Default to set it.");
            }

            ICoreTransaction?parent = dic.TryGetC(bc);

            dic[bc] = coreTransaction = factory(parent);
        }
示例#4
0
        Transaction(Func <ICoreTransaction, ICoreTransaction> factory)
        {
            if (currents.Value == null)
            {
                currents.Value = new Dictionary <Connector, ICoreTransaction>();
            }

            Connector bc = Connector.Current;

            if (bc == null)
            {
                throw new InvalidOperationException("ConnectionScope.Current not established. Use ConnectionScope.Default to set it.");
            }

            ICoreTransaction parent = currents.Value.TryGetC(bc);

            currents.Value[bc] = coreTransaction = factory(parent);
        }
示例#5
0
 public TestTransaction(ICoreTransaction parent, IsolationLevel?isolation)
     : base(parent, isolation)
 {
     oldTestTransaction      = inTestTransaction.Value;
     inTestTransaction.Value = true;
 }
示例#6
0
 public NoneTransaction(ICoreTransaction parent)
 {
     this.parent = parent;
 }
示例#7
0
 public RealTransaction(ICoreTransaction parent, IsolationLevel?isolationLevel)
 {
     IsolationLevel = isolationLevel;
     this.parent    = parent;
 }