0

Is it possible to select from a table which is currently locked by a script which updates thousads of records?

EDIT: As some posters suggested, I've tried following but it does not work. It still breaks when updating large amount of records

 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;
            }
        }
Robert
  • 3,353
  • 4
  • 32
  • 50
  • Did you try to use stored procedures with NOLOCK queries via Entity? – Kadir Çetintaş Jul 16 '18 at 10:02
  • I'm not sure if data can be read when it's being locked, but I remember something about Entity Isolation Levels, check this link out, it might help you. https://msdn.microsoft.com/en-us/library/system.transactions.isolationlevel(v=vs.110).aspx – RedNet Jul 16 '18 at 10:03
  • setting ISOLATION LEVEL to READ UNCOMMITTED should do the trick – Pablo Henkowski Jul 16 '18 at 10:39
  • You can refer my previous post :-[Locking in SQL](https://stackoverflow.com/questions/51324511/sql-server-are-transaction-locking-table-for-other-users/51324881#51324881) – Deepak Kumar Jul 16 '18 at 12:18

0 Answers0