Show / Hide Table of Contents

Class NpgsqlTransaction

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

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

Properties

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.

DbConnection

Specifies the NpgsqlConnection object associated with the transaction.

Declaration
protected override DbConnection DbConnection { get; }
Property Value
Type Description
System.Data.Common.DbConnection

The NpgsqlConnection object associated with the transaction.

Overrides
System.Data.Common.DbTransaction.DbConnection

IsCompleted

Specifies the completion state of the transaction.

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

The completion state of the transaction.

IsolationLevel

Specifies the System.Data.IsolationLevel for this transaction.

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

The System.Data.IsolationLevel for this transaction. The default is ReadCommitted.

Overrides
System.Data.Common.DbTransaction.IsolationLevel

Methods

Commit()

Commits the database transaction.

Declaration
public override void Commit()
Overrides
System.Data.Common.DbTransaction.Commit()

CommitAsync()

Commits the database transaction.

Declaration
public Task CommitAsync()
Returns
Type Description
System.Threading.Tasks.Task

CommitAsync(CancellationToken)

Commits the database transaction.

Declaration
public Task CommitAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task

Dispose(Boolean)

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

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
Overrides
System.Data.Common.DbTransaction.Dispose(System.Boolean)

Release(String)

Rolls back a transaction from a pending savepoint state.

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

Rollback()

Rolls back a transaction from a pending state.

Declaration
public override void Rollback()
Overrides
System.Data.Common.DbTransaction.Rollback()

Rollback(String)

Rolls back a transaction from a pending savepoint state.

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

RollbackAsync()

Rolls back a transaction from a pending state.

Declaration
public Task RollbackAsync()
Returns
Type Description
System.Threading.Tasks.Task

RollbackAsync(CancellationToken)

Rolls back a transaction from a pending state.

Declaration
public Task RollbackAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task

Save(String)

Creates a transaction save point.

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

Implements

System.Data.IDbTransaction
System.IDisposable
Back to top Generated by DocFX