是否可以从当前被更新数千条记录的脚本锁定的表中进行选择?
编辑: 正如一些海报所建议的那样,我尝试了以下操作,但是它不起作用。在更新大量记录时仍然会中断
public static async Task<List<T>> ToListReadUncommittedAsync<T>(this IQueryable<T> query)
{
using (var scope = new TransactionScope(
TransactionScopeOption.Required,
new TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted,
}, TransactionScopeAsyncFlowOption.Enabled))
{
List<T> toReturn = await query.ToListAsync();
scope.Complete();
return toReturn;
}
}