Exemple #1
0
 /// <summary>
 /// Creates a new transaction having the given parameters.
 /// </summary>
 /// <param name="myDistributed">Indicates that this transaction should synched within the entire cluster.</param>
 /// <param name="myLongRunning">Indicates that this transaction is a long-running transaction.</param>
 /// <param name="myIsolationLevel">The isolation level of this transaction.</param>
 /// <param name="myName">A name or identification for this transaction.</param>
 /// <param name="myTimeStamp"></param>
 public FSTransaction(Boolean myDistributed = false, Boolean myLongRunning = false, IsolationLevel myIsolationLevel = IsolationLevel.Serializable, String myName = "", DateTime? myTimeStamp = null)
     : base(myDistributed, myLongRunning, myIsolationLevel, myName, myTimeStamp)
 {
     _NestedTransaction = null;
 }
 public TransactionDisposedEventArgs(FSTransaction myTransaction, SessionToken mySessionToken)
 {
     _Transaction = myTransaction;
     _SessionToken = mySessionToken;
 }
Exemple #3
0
        /// <summary>
        /// Creates a nested transaction having the given parameters.
        /// </summary>
        /// <param name="myDistributed">Indicates that the nested transaction should synched within the entire cluster.</param>
        /// <param name="myLongRunning">Indicates that the nested transaction is a long-running transaction.</param>
        /// <param name="myIsolationLevel">The isolation level of the nested transaction.</param>
        /// <param name="myName">A name or identification for the nested transaction.</param>
        public FSTransaction BeginNestedTransaction(Boolean myDistributed, Boolean myLongRunning, IsolationLevel myIsolationLevel, String myName, DateTime? myTimeStamp = null)
        {
            switch (State)
            {

                // Running => Rolledback
                case TransactionState.Running:
                    _NestedTransaction = new FSTransaction(myDistributed, myLongRunning, myIsolationLevel, myName, myTimeStamp);
                    return _NestedTransaction;

                // NestedTransactions => Error!
                // At the moment do not allow to auto-commit the nested transactions!
                case TransactionState.NestedTransaction:
                    return new FSTransaction(new GraphFSError_TransactionAlreadyRolledback());

                // Committing => Error!
                case TransactionState.Committing:
                    return new FSTransaction(new GraphFSError_TransactionCurrentlyCommitting());

                // Commited => Error!
                case TransactionState.Committed:
                    return new FSTransaction(new GraphFSError_TransactionAlreadyCommited());

                // RollingBack => Error!
                case TransactionState.RollingBack:
                    return new FSTransaction(new GraphFSError_TransactionCurrentlyRollingBack());

                // RolledBack => Error!
                case TransactionState.RolledBack:
                    return new FSTransaction(new GraphFSError_TransactionAlreadyRolledback());

                default:
                    throw new GraphFSException("FSTransaction.BeginNestedTransaction() is invalid!");

            }
        }