共用方式為


RelationalConnection.ConnectionBeginTransactionAsync Method

Definition

Template method that by default calls BeginDbTransactionAsync(IsolationLevel, CancellationToken) but can be overridden by providers to make a different call instead.

protected virtual System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction> ConnectionBeginTransactionAsync (System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
abstract member ConnectionBeginTransactionAsync : System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
override this.ConnectionBeginTransactionAsync : System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Data.Common.DbTransaction>
Protected Overridable Function ConnectionBeginTransactionAsync (isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of DbTransaction)

Parameters

isolationLevel
IsolationLevel

The isolation level to use for the transaction.

cancellationToken
CancellationToken

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

Returns

The newly created transaction.

Exceptions

Applies to