RelationalDatabaseFacadeExtensions.UseTransaction Method
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.
Overloads
UseTransaction(DatabaseFacade, DbTransaction) |
Sets the DbTransaction to be used by database operations on the DbContext. |
UseTransaction(DatabaseFacade, DbTransaction, Guid) |
Sets the DbTransaction to be used by database operations on the DbContext. |
UseTransaction(DatabaseFacade, DbTransaction)
Sets the DbTransaction to be used by database operations on the DbContext.
public static Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction UseTransaction (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction transaction);
public static Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction? UseTransaction (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction? transaction);
static member UseTransaction : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * System.Data.Common.DbTransaction -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
<Extension()>
Public Function UseTransaction (databaseFacade As DatabaseFacade, transaction As DbTransaction) As IDbContextTransaction
Parameters
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
- transaction
- DbTransaction
The DbTransaction to use.
Returns
A IDbContextTransaction that encapsulates the given transaction.
Remarks
See Transactions in EF Core for more information and examples.
Applies to
UseTransaction(DatabaseFacade, DbTransaction, Guid)
Sets the DbTransaction to be used by database operations on the DbContext.
public static Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction UseTransaction (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction transaction, Guid transactionId);
public static Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction? UseTransaction (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction? transaction, Guid transactionId);
static member UseTransaction : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * System.Data.Common.DbTransaction * Guid -> Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction
<Extension()>
Public Function UseTransaction (databaseFacade As DatabaseFacade, transaction As DbTransaction, transactionId As Guid) As IDbContextTransaction
Parameters
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
- transaction
- DbTransaction
The DbTransaction to use.
- transactionId
- Guid
The unique identifier for the transaction.
Returns
A IDbContextTransaction that encapsulates the given transaction.
Remarks
See Transactions in EF Core for more information and examples.
Applies to
Entity Framework