Skip to content

Settings and activity

2 results found

  1. 1,272 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Hallur Holm Johannessen supported this idea  · 
  2. 129 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Hallur Holm Johannessen commented  · 

    I have been using the following extension method.
    You need to add it to the My Extensions file, which you can see in the My Queries tab.

    public static class MyExtensions
    {
    public static IQueryable<T> DumpNoLock<T>(this IQueryable<T> query)
    {
    using (new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew,
    new TransactionOptions
    {
    IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
    }))
    {
    return query.Dump();
    }
    }
    }

    So now you can dump your query using the following syntax:

    Table1.Where(t1 => t1.Enabled).DumpNoLock()

    Which is equivalent to including the NOLOCK option on your sql query.