以下是将Ambient Context与EF6一起使用的C#代码
public async Task<bool> RemoveRefreshToken(RefreshToken refreshToken)
{
using (var dbContextScope = _dbContextScopeFactory.Create())
{
_refreshTokenRepository.Delete(refreshToken);
return await dbContextScope.SaveChangesAsync() > 0;
}
}
获取以下异常
Exception Source: EntityFramework Inner Exception: Transaction (Process ID
89) was deadlocked on lock resources with another process and has been chosen
as the deadlock victim. Rerun the transaction.
仅当使用JMeter进行并发请求时,才会发生此错误