语言

ISaveChangesInterceptor.ThrowingConcurrencyExceptionAsync 方法

定义

在 EF 要引发之前 DbUpdateConcurrencyException立即调用 。

public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult> ThrowingConcurrencyExceptionAsync(Microsoft.EntityFrameworkCore.Diagnostics.ConcurrencyExceptionEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult result, System.Threading.CancellationToken cancellationToken = default);
abstract member ThrowingConcurrencyExceptionAsync : Microsoft.EntityFrameworkCore.Diagnostics.ConcurrencyExceptionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
override this.ThrowingConcurrencyExceptionAsync : Microsoft.EntityFrameworkCore.Diagnostics.ConcurrencyExceptionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
Public Overridable Function ThrowingConcurrencyExceptionAsync (eventData As ConcurrencyExceptionEventData, result As InterceptionResult, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult)

参数

eventData
ConcurrencyExceptionEventData

有关并发冲突的上下文信息。

result
InterceptionResult

表示当前结果(如果存在)。 如果某些以前的拦截器通过调用取消执行,则此值将设置为 < a0/a0> 。 此值通常用作此方法实现的返回值。

cancellationToken
CancellationToken

等待任务完成时观察的 A CancellationToken 。

返回

false如果是IsSuppressed,则 EF 将引发异常。 true如果是IsSuppressed,则 EF 不会引发异常。 未尝试禁止设置属性值的任何拦截器的此方法的实现必须返回 result 传入的值。

例外

如果取消了该操作 CancellationToken 。

适用于