Beispiel #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;
            }
Beispiel #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;
            }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
 public TestTransaction(ICoreTransaction parent, IsolationLevel?isolation)
     : base(parent, isolation)
 {
     oldTestTransaction      = inTestTransaction.Value;
     inTestTransaction.Value = true;
 }
Beispiel #6
0
 public NoneTransaction(ICoreTransaction parent)
 {
     this.parent = parent;
 }
Beispiel #7
0
 public RealTransaction(ICoreTransaction parent, IsolationLevel?isolationLevel)
 {
     IsolationLevel = isolationLevel;
     this.parent    = parent;
 }