?
Solved

LINQ with NOLOCK/ROWLOCK/READPAST

Posted on 2010-01-12
1
Medium Priority
?
2,872 Views
Last Modified: 2013-11-11
hi, how do I set Locking when using LINQ to query a database (NOLOCK/READPAST) and to using LINQ to update a table (ROWLOCK) ?

is it possible to combine different types of locking in a single LINQ transaction scope ?
0
Comment
Question by:Michhoho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 2000 total points
ID: 26300271
NOLOCK:

Just set the transaction isolation level to READ UNCOMMITTED to achieve NOLOCK equivalent and the example below:

http://www.infoq.com/news/2008/03/linq-nolock

ROWLOCK:

Haven't used this one on my own and hence test it out

http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/e9e958d0-0661-42a6-8793-d9d9108ec70b
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question