DatabaseFacade.CurrentTransaction Property
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.
Gets the current IDbContextTransaction being used by the context, or null if no transaction is in use.
public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction CurrentTransaction { get; }
public virtual Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction? CurrentTransaction { get; }
member this.CurrentTransaction : Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
Public Overridable ReadOnly Property CurrentTransaction As IDbContextTransaction
Property Value
Remarks
This property is null unless one of BeginTransaction(), Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.BeginTransaction, or Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.UseTransaction has been called. No attempt is made to obtain a transaction from the current DbConnection or similar.
For relational databases, the underlying DbTransaction can be obtained using Microsoft.EntityFrameworkCore.Storage.DbContextTransactionExtensions.GetDbTransaction on the returned IDbContextTransaction.
See Transactions in EF Core for more information and examples.
Applies to
Entity Framework