Udostępnij za pośrednictwem


RelationalDatabaseFacadeExtensions.UseTransactionAsync Method

Definition

Overloads

UseTransactionAsync(DatabaseFacade, DbTransaction, CancellationToken)

Sets the DbTransaction to be used by database operations on the DbContext.

UseTransactionAsync(DatabaseFacade, DbTransaction, Guid, CancellationToken)

Sets the DbTransaction to be used by database operations on the DbContext.

UseTransactionAsync(DatabaseFacade, DbTransaction, CancellationToken)

Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs

Sets the DbTransaction to be used by database operations on the DbContext.

public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> UseTransactionAsync (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction transaction, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction?> UseTransactionAsync (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction? transaction, System.Threading.CancellationToken cancellationToken = default);
static member UseTransactionAsync : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * System.Data.Common.DbTransaction * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
<Extension()>
Public Function UseTransactionAsync (databaseFacade As DatabaseFacade, transaction As DbTransaction, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IDbContextTransaction)

Parameters

databaseFacade
DatabaseFacade

The DatabaseFacade for the context.

transaction
DbTransaction

The DbTransaction to use.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A Task containing the IDbContextTransaction for the given transaction.

Exceptions

Remarks

See Transactions in EF Core for more information and examples.

Applies to

UseTransactionAsync(DatabaseFacade, DbTransaction, Guid, CancellationToken)

Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs
Source:
RelationalDatabaseFacadeExtensions.cs

Sets the DbTransaction to be used by database operations on the DbContext.

public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction> UseTransactionAsync (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction transaction, Guid transactionId, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction?> UseTransactionAsync (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade, System.Data.Common.DbTransaction? transaction, Guid transactionId, System.Threading.CancellationToken cancellationToken = default);
static member UseTransactionAsync : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade * System.Data.Common.DbTransaction * Guid * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction>
<Extension()>
Public Function UseTransactionAsync (databaseFacade As DatabaseFacade, transaction As DbTransaction, transactionId As Guid, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IDbContextTransaction)

Parameters

databaseFacade
DatabaseFacade

The DatabaseFacade for the context.

transaction
DbTransaction

The DbTransaction to use.

transactionId
Guid

The unique identifier for the transaction.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A Task containing the IDbContextTransaction for the given transaction.

Exceptions

Remarks

See Transactions in EF Core for more information and examples.

Applies to