Web Technologist
NOLOCK in LINQ
The NOLOCK table hint, also known as READUNCOMITTED, is applicable to SELECT statements only. NOLOCK indicates that no shared locks are issued against the table that would prohibit other transactions from modifying the data in the table.
The most recommended way of implementing NOLOCK is to use a TransactionScope to affect the TransactionOptions associated with the commands of the LINQ context.
Heres a sample code :
using (new System.Transactions.TransactionScope(
System.Transactions.TransactionScopeOption.Required,
new System.Transactions.TransactionOptions
{
IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
}))
{
// Retreive Data
}
| Print article |
Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

