IDbContextTransaction Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A transaction against the database.
public interface IDbContextTransaction : IDisposable
public interface IDbContextTransaction : IAsyncDisposable, IDisposable
type IDbContextTransaction = interface
interface IDisposable
type IDbContextTransaction = interface
interface IDisposable
interface IAsyncDisposable
Public Interface IDbContextTransaction
Implements IDisposable
Public Interface IDbContextTransaction
Implements IAsyncDisposable, IDisposable
- Derived
- Implements
Remarks
Instances of this class are typically obtained from BeginTransaction() and it is not designed to be directly constructed in your application code.
See Transactions in EF Core for more information and examples.
Properties
SupportsSavepoints |
Gets a value that indicates whether this IDbContextTransaction instance supports
database savepoints. If |
TransactionId |
Gets the transaction identifier. |
Methods
Commit() |
Commits all changes made to the database in the current transaction. |
CommitAsync(CancellationToken) |
Commits all changes made to the database in the current transaction asynchronously. |
CreateSavepoint(String) |
Creates a savepoint in the transaction. This allows all commands that are executed after the savepoint was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint. |
CreateSavepointAsync(String, CancellationToken) |
Creates a savepoint in the transaction. This allows all commands that are executed after the savepoint was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint. |
ReleaseSavepoint(String) |
Destroys a savepoint previously defined in the current transaction. This allows the system to reclaim some resources before the transaction ends. |
ReleaseSavepointAsync(String, CancellationToken) |
Destroys a savepoint previously defined in the current transaction. This allows the system to reclaim some resources before the transaction ends. |
Rollback() |
Discards all changes made to the database in the current transaction. |
RollbackAsync(CancellationToken) |
Discards all changes made to the database in the current transaction asynchronously. |
RollbackToSavepoint(String) |
Rolls back all commands that were executed after the specified savepoint was established. |
RollbackToSavepointAsync(String, CancellationToken) |
Rolls back all commands that were executed after the specified savepoint was established. |
Extension Methods
GetDbTransaction(IDbContextTransaction) |
Gets the underlying DbTransaction for the given transaction. Throws if the database being targeted is not a relational database that uses DbTransaction. |
Applies to
Entity Framework