Class NpgsqlTransaction
Represents a transaction to be made in a PostgreSQL database. This class cannot be inherited.
Inheritance
Implements
Inherited Members
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
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
Methods
Commit()
Commits the database transaction.
Declaration
public override void Commit()
Overrides
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
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
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 |