QueryExpression.NoLock Property
Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online
Gets or sets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query.
Namespace: Microsoft.Xrm.Sdk.Query
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)
Syntax
'Declaration
<DataMemberAttribute(Order:=50)> _
Public Property NoLock As Boolean
[DataMemberAttribute(Order=50)]
public bool NoLock { get; set; }
Property Value
Type: Boolean
true if there are no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query; otherwise, false.
Remarks
The benefit of setting NoLock to true is that it allows you to keep the system from issuing locks against the entities in your queries; this increases concurrency and performance because the database engine does not have to maintain the shared locks involved. The downside is that, because no locks are issued against the records being read, some "dirty” or uncommitted data could potentially be read. A "dirty" read is one in which the data being read is involved in a transaction from another connection. If that transaction rolls back its work, the data read from the query using NoLock will have read uncommitted data. This type of read makes processing inconsistent and can lead to problems.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
Windows Server 2008, Windows Server 2012, Windows 7 (All Versions), Windows 8 (All Versions)
Target Platforms
Windows Server 2008, ,Windows Server 2012, ,Windows 7 (All Versions),
See Also
Reference
QueryExpression Class
QueryExpression Members
Microsoft.Xrm.Sdk.Query Namespace
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.