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