RelationalDatabaseFacadeExtensions.UseTransaction Method

Definition

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