public static List<T> ToListReadUncommitted<T>(this IQueryable<T> query)
        {
            using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
            {
                List<T> toReturn = query.ToList();
                scope.Complete();
                return toReturn;
            }
        }

        public static int CountReadUncommitted<T>(this IQueryable<T> query)
        {
            using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
            {
                int toReturn = query.Count();
                scope.Complete();
                return toReturn;
            }
        }

相关文章:

  • 2021-07-06
  • 2021-12-05
  • 2022-12-23
  • 2021-11-23
  • 2022-01-18
  • 2022-02-18
猜你喜欢
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-11-03
相关资源
相似解决方案