Search Results for

    Show / Hide Table of Contents

    Class AdbTransaction

    An Adb local database transaction, which works in the same way as the underlying .NET DbTransaction, with extra information and functionality. It is created by calling one of the BeginTransaction() overloads.

    Note: The AdbTransaction instance is not thread-safe, and must only be used in a single place (in a single worker) at any one time.

    The instance must be disposed after use. Disposal should almost always be done by whoever created the connection, typically via DisposeOnFinished<TDisposable>(TDisposable) or UsingActionWorker<TDisposable> if used across multiple method calls, or by a using statement if created and disposed in a single method and thread, without being passed to any other workers. See Disposing Disposables for details.

    Note: Using AdbTransaction with full error handling is somewhat involved. Please use AdbTransactionActionWorker where possible, which is simpler since it comes pre-configured to run database commands and any child workers within an AdbTransaction.

    Inheritance
    Object
    AdbTransaction
    Implements
    IAdbTransaction
    IDisposable
    Namespace: actionETL.Adb
    Assembly: actionETL.dll
    Syntax
    public sealed class AdbTransaction : IAdbTransaction, IDisposable
    Examples

    See AdbTransaction Example for how to use this class.

    Properties

    Connection

    Gets the connection for the transaction, or null if the database transaction is no longer valid.

    Declaration
    public AdbConnection Connection { get; }
    Property Value
    Type Description
    AdbConnection

    IsolationLevel

    Gets the IsolationLevel for this database transaction. The default is provider dependent.

    Declaration
    public IsolationLevel IsolationLevel { get; }
    Property Value
    Type Description
    IsolationLevel

    UnderlyingTransaction

    Gets the underlying .NET DbTransaction.

    Note: Always use the members on AdbTransaction instead of this UnderlyingConnection wherever possible. In rare cases however, the underlying .NET DbTransaction is needed, e.g. when accessing provider-specific functionality not covered by AdbTransaction.

    Declaration
    public DbTransaction UnderlyingTransaction { get; }
    Property Value
    Type Description
    DbTransaction

    Methods

    Commit()

    Commits the database transaction.

    Declaration
    public void Commit()
    Exceptions
    Type Condition
    Exception
    • An error occurred while trying to commit the transaction.
    • (See the provider documentation for specific Commit() exceptions.)
    InvalidOperationException
    • The transaction has already been committed or rolled back.
    • The connection is broken.

    Dispose()

    Dispose the database transaction.

    Declaration
    public void Dispose()

    Rollback()

    Rolls back the database transaction from a pending state.

    Declaration
    public void Rollback()
    Exceptions
    Type Condition
    Exception
    • An error occurred while trying to rollback the transaction.
    • (See the provider documentation for specific Rollback() exceptions.)
    InvalidOperationException
    • The transaction has already been committed or rolled back.
    • The connection is broken.

    Implements

    IAdbTransaction
    System.IDisposable

    See Also

    AdbKeepOpenConnectionBuilder
    AdbTransactionActionWorker
    In This Article
    Back to top Copyright © 2023 Envobi Ltd