Entity Framework с NOLOCK
С помощью методов расширения c-sharp это можно упростить
public static List ToListReadUncommitted(this IQueryable query)
{
using (var scope = new TransactionScope(
TransactionScopeOption.Required,
new TransactionOptions() {
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
{
List toReturn = query.ToList();
scope.Complete();
return toReturn;
}
}
public static int CountReadUncommitted(this IQueryable query)
{
using (var scope = new TransactionScope(
TransactionScopeOption.Required,
new TransactionOptions() {
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted }))
{
int toReturn = query.Count();
scope.Complete();
return toReturn;
}
}
c#
entity-framework
ado.net
2021-12-22T14:29:43+00:00
2022-11-16T21:34:36+00:00
LyKeNG
Вопросы с похожей тематикой, как у вопроса:
Entity Framework с NOLOCK
Предупреждение о файлах Cookies
Мы используем файлы cookies для улучшения работы сайта. Оставаясь на нашем сайте, вы соглашаетесь с условиями использования файлов cookies. Чтобы ознакомиться с нашими Положениями о конфиденциальности и об использовании файлов cookie, нажмите здесь.