Table of Contents

Class NpgsqlTransaction

Namespace
Npgsql
Assembly
Npgsql.dll

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

public sealed class NpgsqlTransaction : DbTransaction, IDbTransaction, IDisposable, IAsyncDisposable
Inheritance
NpgsqlTransaction
Implements
Inherited Members

Properties

Connection

Specifies the NpgsqlConnection object associated with the transaction.

public NpgsqlConnection Connection { get; }

Property Value

NpgsqlConnection

The NpgsqlConnection object associated with the transaction.

DbConnection

Specifies the NpgsqlConnection object associated with the transaction.

protected override DbConnection DbConnection { get; }

Property Value

DbConnection

The NpgsqlConnection object associated with the transaction.

IsCompleted

Specifies the completion state of the transaction.

public bool IsCompleted { get; }

Property Value

bool

The completion state of the transaction.

IsolationLevel

Specifies the IsolationLevel for this transaction.

public override IsolationLevel IsolationLevel { get; }

Property Value

IsolationLevel

The IsolationLevel for this transaction. The default is ReadCommitted.

Methods

Commit()

Commits the database transaction.

public override void Commit()

CommitAsync()

Commits the database transaction.

public Task CommitAsync()

Returns

Task

CommitAsync(CancellationToken)

Commits the database transaction.

public Task CommitAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

Dispose(bool)

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

protected override void Dispose(bool disposing)

Parameters

disposing bool

Release(string)

Rolls back a transaction from a pending savepoint state.

public void Release(string name)

Parameters

name string

Rollback()

Rolls back a transaction from a pending state.

public override void Rollback()

Rollback(string)

Rolls back a transaction from a pending savepoint state.

public void Rollback(string name)

Parameters

name string

RollbackAsync()

Rolls back a transaction from a pending state.

public Task RollbackAsync()

Returns

Task

RollbackAsync(CancellationToken)

Rolls back a transaction from a pending state.

public Task RollbackAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

Save(string)

Creates a transaction save point.

public void Save(string name)

Parameters

name string