Example #1
0
        /// <summary>
        /// Releases all resources used by the <see cref="AseConnection" />.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (_isDisposed)
            {
                return;
            }

            if (_transaction != null && !_transaction.IsDisposed)
            {
                _transaction.Dispose(); // Will also rollback the transaction
            }

            _transaction = null;

            try
            {
                Close();

                // Kill listening references that might keep this object from being garbage collected.
                StateChangeInternal = null;
                InfoMessageInternal = null;
                TraceEnterInternal  = null;
                TraceExitInternal   = null;
            }
            finally
            {
                _isDisposed = true;
            }
        }
Example #2
0
        internal AseCommand(AseConnection connection)
        {
            _connection  = connection;
            _transaction = connection.Transaction;

            AseParameters = new AseParameterCollection();
        }
        /// <summary>
        /// Releases all resources used by the <see cref="AseConnection" />.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (_isDisposed)
            {
                return;
            }

            if (_transaction != null && !_transaction.IsDisposed)
            {
                _transaction.Dispose(); // Will also rollback the transaction
            }

            _transaction = null;

            try
            {
                Close();

                // Kill listening references that might keep this object from being garbage collected.
                _eventNotifier.ClearAll();
            }
            finally
            {
                _isDisposed = true;
            }
        }
Example #4
0
        /// <summary>
        /// Constructor function for an <see cref="AseCommand"/> instance.
        /// </summary>
        /// <param name="commandText">The command text to execute</param>
        /// <param name="connection">The connection upon which to execute</param>
        /// <param name="transaction">The transaction within which to execute</param>
        public AseCommand(string commandText, AseConnection connection, AseTransaction transaction)
        {
            _connection  = connection;
            _transaction = transaction;

            AseParameters = new AseParameterCollection();

            CommandText = commandText;
        }
Example #5
0
        /// <summary>
        /// Starts a database transaction.
        /// </summary>
        /// <param name="isolationLevel">The isolation level under which the transaction should run.</param>
        /// <returns>An object representing the new transaction.</returns>
        /// <remarks>
        /// <para>This command maps to the SQL Server implementation of BEGIN TRANSACTION.</para>
        /// <para>You must explicitly commit or roll back the transaction using the <see cref="AseTransaction.Commit" />
        /// or <see cref="AseTransaction.Rollback" /> method. To make sure that the .NET Framework Data Provider for ASE
        /// transaction management model performs correctly, avoid using other transaction management models, such as the
        /// one provided by ASE.</para>
        /// <para>If you do not specify an isolation level, the default isolation level is used. To specify an isolation
        /// level with the <see cref="BeginTransaction" /> method, use the overload that takes the iso parameter
        /// (<see cref="BeginTransaction(IsolationLevel)" />).</para>
        /// </remarks>
        public new AseTransaction BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified)
        {
            if (_isDisposed)
            {
                throw new ObjectDisposedException(nameof(AseConnection));
            }

            Open();
            _transaction = new AseTransaction(this, isolationLevel);
            _transaction.Begin();
            return(_transaction);
        }
Example #6
0
 /// <summary>
 /// Constructor function for an <see cref="AseCommand"/> instance.
 /// </summary>
 /// <param name="commandText">The command text to execute</param>
 /// <param name="connection">The connection upon which to execute</param>
 /// <param name="transaction">The transaction within which to execute</param>
 public AseCommand(string commandText, AseConnection connection, AseTransaction transaction) : this(commandText, connection)
 {
     _transaction = transaction;
 }
Example #7
0
 /// <summary>
 /// Constructor function for an <see cref="AseCommand"/> instance.
 /// </summary>
 /// <param name="commandText">The command text to execute</param>
 /// <param name="connection">The connection upon which to execute</param>
 public AseCommand(string commandText, AseConnection connection) : this(commandText)
 {
     _connection  = connection;
     _transaction = connection.Transaction;
 }