Search Results for

    Show / Hide Table of Contents

    Class NpgsqlTransaction

    Represents a transaction to be made in a PostgreSQL database. This class cannot be inherited.

    Inheritance
    Object
    MarshalByRefObject
    DbTransaction
    NpgsqlTransaction
    Implements
    IDbTransaction
    IDisposable
    IAsyncDisposable
    Inherited Members
    DbTransaction.Dispose()
    DbTransaction.IDbTransaction.Connection
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.MemberwiseClone(Boolean)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public sealed class NpgsqlTransaction : DbTransaction, IDbTransaction, IDisposable, IAsyncDisposable

    Properties

    | Improve this Doc

    Connection

    Specifies the NpgsqlConnection object associated with the transaction.

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

    The NpgsqlConnection object associated with the transaction.

    | Improve this Doc

    DbConnection

    Specifies the NpgsqlConnection object associated with the transaction.

    Declaration
    protected override DbConnection DbConnection { get; }
    Property Value
    Type Description
    DbConnection

    The NpgsqlConnection object associated with the transaction.

    Overrides
    DbTransaction.DbConnection
    | Improve this Doc

    IsCompleted

    Specifies the completion state of the transaction.

    Declaration
    public bool IsCompleted { get; }
    Property Value
    Type Description
    Boolean

    The completion state of the transaction.

    | Improve this Doc

    IsolationLevel

    Specifies the IsolationLevel for this transaction.

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

    The IsolationLevel for this transaction. The default is ReadCommitted.

    Overrides
    DbTransaction.IsolationLevel

    Methods

    | Improve this Doc

    Commit()

    Commits the database transaction.

    Declaration
    public override void Commit()
    Overrides
    DbTransaction.Commit()
    | Improve this Doc

    CommitAsync()

    Commits the database transaction.

    Declaration
    public Task CommitAsync()
    Returns
    Type Description
    Task
    | Improve this Doc

    CommitAsync(CancellationToken)

    Commits the database transaction.

    Declaration
    public override Task CommitAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task
    Overrides
    DbTransaction.CommitAsync(CancellationToken)
    | Improve this Doc

    Dispose(Boolean)

    Disposes the transaction, rolling it back if it is still pending.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing
    Overrides
    DbTransaction.Dispose(Boolean)
    | Improve this Doc

    DisposeAsync()

    Disposes the transaction, rolling it back if it is still pending.

    Declaration
    public override ValueTask DisposeAsync()
    Returns
    Type Description
    ValueTask
    Overrides
    DbTransaction.DisposeAsync()
    | Improve this Doc

    Release(String)

    Releases a transaction from a pending savepoint state.

    Declaration
    public void Release(string name)
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    | Improve this Doc

    ReleaseAsync(String, CancellationToken)

    Releases a transaction from a pending savepoint state.

    Declaration
    public Task ReleaseAsync(string name, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task
    | Improve this Doc

    Rollback()

    Rolls back a transaction from a pending state.

    Declaration
    public override void Rollback()
    Overrides
    DbTransaction.Rollback()
    | Improve this Doc

    Rollback(String)

    Rolls back a transaction from a pending savepoint state.

    Declaration
    public void Rollback(string name)
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    | Improve this Doc

    RollbackAsync()

    Rolls back a transaction from a pending state.

    Declaration
    public Task RollbackAsync()
    Returns
    Type Description
    Task
    | Improve this Doc

    RollbackAsync(String, CancellationToken)

    Rolls back a transaction from a pending savepoint state.

    Declaration
    public Task RollbackAsync(string name, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task
    | Improve this Doc

    RollbackAsync(CancellationToken)

    Rolls back a transaction from a pending state.

    Declaration
    public override Task RollbackAsync(CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task
    Overrides
    DbTransaction.RollbackAsync(CancellationToken)
    | Improve this Doc

    Save(String)

    Creates a transaction save point.

    Declaration
    public void Save(string name)
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    | Improve this Doc

    SaveAsync(String, CancellationToken)

    Creates a transaction save point.

    Declaration
    public Task SaveAsync(string name, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    String name

    The name of the savepoint.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests. The default value is None.

    Returns
    Type Description
    Task

    Implements

    System.Data.IDbTransaction
    System.IDisposable
    System.IAsyncDisposable
    • Improve this Doc
    In This Article
    Back to top © Copyright 2021 The Npgsql Development Team