RelationalExecutionStrategyExtensions.ExecuteInTransactionAsync 方法

定义

重载

ExecuteInTransactionAsync(IExecutionStrategy, Func<Task>, Func<Task<Boolean>>, IsolationLevel)

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

ExecuteInTransactionAsync(IExecutionStrategy, Func<CancellationToken,Task>, Func<CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

ExecuteInTransactionAsync<TResult>(IExecutionStrategy, Func<CancellationToken, Task<TResult>>, Func<CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

在事务中执行指定的异步操作并返回结果。 允许检查提交期间发生错误时事务是否已回滚。

ExecuteInTransactionAsync<TState,TResult>(IExecutionStrategy, TState, Func<TState,CancellationToken,Task<TResult>>, Func<TState, CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

执行指定的异步操作并返回结果。 允许检查提交期间发生错误时事务是否已回滚。

ExecuteInTransactionAsync<TState>(IExecutionStrategy, TState, Func<TState,CancellationToken,Task>, Func<TState,CancellationToken, Task<Boolean>>, IsolationLevel, CancellationToken)

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

ExecuteInTransactionAsync(IExecutionStrategy, Func<Task>, Func<Task<Boolean>>, IsolationLevel)

Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

public static System.Threading.Tasks.Task ExecuteInTransactionAsync (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<System.Threading.Tasks.Task> operation, Func<System.Threading.Tasks.Task<bool>> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransactionAsync : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<System.Threading.Tasks.Task> * Func<System.Threading.Tasks.Task<bool>> * System.Data.IsolationLevel -> System.Threading.Tasks.Task
<Extension()>
Public Function ExecuteInTransactionAsync (strategy As IExecutionStrategy, operation As Func(Of Task), verifySucceeded As Func(Of Task(Of Boolean)), isolationLevel As IsolationLevel) As Task

参数

strategy
IExecutionStrategy

将用于执行的策略。

operation
Func<Task>

返回已启动任务的函数。

verifySucceeded
Func<Task<Boolean>>

一个委托,用于测试操作是否成功,即使提交事务时引发了异常。

isolationLevel
IsolationLevel

要用于该事务的隔离级别。

返回

如果原始任务成功完成, (第一次或重试暂时性故障) 后,将运行到完成的任务。 如果任务失败并出现非暂时性错误或达到重试限制,则返回的任务将出错,必须观察异常。

例外

在配置的重试次数后,操作未成功。

注解

有关详细信息 和示例,请参阅连接复原和数据库重试

适用于

ExecuteInTransactionAsync(IExecutionStrategy, Func<CancellationToken,Task>, Func<CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

public static System.Threading.Tasks.Task ExecuteInTransactionAsync (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<System.Threading.CancellationToken,System.Threading.Tasks.Task> operation, Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<bool>> verifySucceeded, System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
static member ExecuteInTransactionAsync : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<System.Threading.CancellationToken, System.Threading.Tasks.Task> * Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<bool>> * System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function ExecuteInTransactionAsync (strategy As IExecutionStrategy, operation As Func(Of CancellationToken, Task), verifySucceeded As Func(Of CancellationToken, Task(Of Boolean)), isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As Task

参数

strategy
IExecutionStrategy

将用于执行的策略。

operation
Func<CancellationToken,Task>

返回已启动任务的函数。

verifySucceeded
Func<CancellationToken,Task<Boolean>>

一个委托,用于测试操作是否成功,即使提交事务时引发了异常。

isolationLevel
IsolationLevel

要用于该事务的隔离级别。

cancellationToken
CancellationToken

用于取消重试操作的取消令牌,但不是已处于未执行状态或已成功完成的操作。

返回

如果原始任务成功完成, (第一次或重试暂时性故障) 后,将运行到完成的任务。 如果任务失败并出现非暂时性错误或达到重试限制,则返回的任务将出错,必须观察异常。

例外

在配置的重试次数后,操作未成功。

注解

有关详细信息 和示例,请参阅连接复原和数据库重试

适用于

ExecuteInTransactionAsync<TResult>(IExecutionStrategy, Func<CancellationToken, Task<TResult>>, Func<CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs

在事务中执行指定的异步操作并返回结果。 允许检查提交期间发生错误时事务是否已回滚。

public static System.Threading.Tasks.Task<TResult> ExecuteInTransactionAsync<TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<TResult>> operation, Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<bool>> verifySucceeded, System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
static member ExecuteInTransactionAsync : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<'Result>> * Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<bool>> * System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
<Extension()>
Public Function ExecuteInTransactionAsync(Of TResult) (strategy As IExecutionStrategy, operation As Func(Of CancellationToken, Task(Of TResult)), verifySucceeded As Func(Of CancellationToken, Task(Of Boolean)), isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult)

类型参数

TResult

返回operation的结果类型Task<TResult>

参数

strategy
IExecutionStrategy

将用于执行的策略。

operation
Func<CancellationToken,Task<TResult>>

返回类型 TResult为 的已启动任务的函数。

verifySucceeded
Func<CancellationToken,Task<Boolean>>

一个委托,用于测试操作是否成功,即使提交事务时引发了异常。

isolationLevel
IsolationLevel

要用于该事务的隔离级别。

cancellationToken
CancellationToken

用于取消重试操作的取消令牌,但不是已处于未执行状态或已成功完成的操作。

返回

Task<TResult>

如果原始任务成功完成, (第一次或重试暂时性故障) 后,将运行到完成的任务。 如果任务失败并出现非暂时性错误或达到重试限制,则返回的任务将出错,必须观察异常。

例外

在配置的重试次数后,操作未成功。

注解

有关详细信息 和示例,请参阅连接复原和数据库重试

适用于

ExecuteInTransactionAsync<TState,TResult>(IExecutionStrategy, TState, Func<TState,CancellationToken,Task<TResult>>, Func<TState, CancellationToken,Task<Boolean>>, IsolationLevel, CancellationToken)

Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs

执行指定的异步操作并返回结果。 允许检查提交期间发生错误时事务是否已回滚。

public static System.Threading.Tasks.Task<TResult> ExecuteInTransactionAsync<TState,TResult> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,System.Threading.CancellationToken,System.Threading.Tasks.Task<TResult>> operation, Func<TState,System.Threading.CancellationToken,System.Threading.Tasks.Task<bool>> verifySucceeded, System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
static member ExecuteInTransactionAsync : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, System.Threading.CancellationToken, System.Threading.Tasks.Task<'Result>> * Func<'State, System.Threading.CancellationToken, System.Threading.Tasks.Task<bool>> * System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
<Extension()>
Public Function ExecuteInTransactionAsync(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, CancellationToken, Task(Of TResult)), verifySucceeded As Func(Of TState, CancellationToken, Task(Of Boolean)), isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult)

类型参数

TState

状态的类型。

TResult

返回operation的结果类型Task<TResult>

参数

strategy
IExecutionStrategy

将用于执行的策略。

state
TState

将传递给操作的状态。

operation
Func<TState,CancellationToken,Task<TResult>>

返回类型 TResult为 的已启动任务的函数。

verifySucceeded
Func<TState,CancellationToken,Task<Boolean>>

一个委托,用于测试操作是否成功,即使提交事务时引发了异常。

isolationLevel
IsolationLevel

要用于该事务的隔离级别。

cancellationToken
CancellationToken

用于取消重试操作的取消令牌,但不是已处于未执行状态或已成功完成的操作。

返回

Task<TResult>

如果原始任务成功完成, (第一次或重试暂时性故障) 后,将运行到完成的任务。 如果任务失败并出现非暂时性错误或达到重试限制,则返回的任务将出错,必须观察异常。

例外

在配置的重试次数后,操作未成功。

注解

有关详细信息 和示例,请参阅连接复原和数据库重试

适用于

ExecuteInTransactionAsync<TState>(IExecutionStrategy, TState, Func<TState,CancellationToken,Task>, Func<TState,CancellationToken, Task<Boolean>>, IsolationLevel, CancellationToken)

Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs
Source:
RelationalExecutionStrategyExtensions.cs

在事务中执行指定的异步操作。 允许检查提交期间发生错误时事务是否已回滚。

public static System.Threading.Tasks.Task ExecuteInTransactionAsync<TState> (this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,System.Threading.CancellationToken,System.Threading.Tasks.Task> operation, Func<TState,System.Threading.CancellationToken,System.Threading.Tasks.Task<bool>> verifySucceeded, System.Data.IsolationLevel isolationLevel, System.Threading.CancellationToken cancellationToken = default);
static member ExecuteInTransactionAsync : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, System.Threading.CancellationToken, System.Threading.Tasks.Task> * Func<'State, System.Threading.CancellationToken, System.Threading.Tasks.Task<bool>> * System.Data.IsolationLevel * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function ExecuteInTransactionAsync(Of TState) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, CancellationToken, Task), verifySucceeded As Func(Of TState, CancellationToken, Task(Of Boolean)), isolationLevel As IsolationLevel, Optional cancellationToken As CancellationToken = Nothing) As Task

类型参数

TState

状态的类型。

参数

strategy
IExecutionStrategy

将用于执行的策略。

state
TState

将传递给操作的状态。

operation
Func<TState,CancellationToken,Task>

返回已启动任务的函数。

verifySucceeded
Func<TState,CancellationToken,Task<Boolean>>

一个委托,用于测试操作是否成功,即使提交事务时引发了异常。

isolationLevel
IsolationLevel

要用于该事务的隔离级别。

cancellationToken
CancellationToken

用于取消重试操作的取消令牌,但不是已处于未执行状态或已成功完成的操作。

返回

如果原始任务成功完成, (第一次或重试暂时性故障) 后,将运行到完成的任务。 如果任务失败并出现非暂时性错误或达到重试限制,则返回的任务将出错,必须观察异常。

例外

在配置的重试次数后,操作未成功。

注解

有关详细信息 和示例,请参阅连接复原和数据库重试

适用于