SqlServerTableHints
This class contains SQL Server table hints for use with the hints argument of most operations.
Usability
Pass the desired hint to the hints argument.
Query with dirty reads.
using (var connection = new SqlConnection(connectionString))
{
var person = connection.QueryAll<Person>(hints: SqlServerTableHints.NoLock);
}
Query only committed records.
using (var connection = new SqlConnection(connectionString))
{
var person = connection.QueryAll<Person>(hints: SqlServerTableHints.ReadPast);
}
Lock the table during insertion.
using (var connection = new SqlConnection(connectionString))
{
var id = connection.Insert<Person>(person, hints: SqlServerTableHints.TabLock);
}
Or during an Update operation.
using (var connection = new SqlConnection(connectionString))
{
var id = connection.Update<Person>(person, hints: SqlServerTableHints.TabLock);
}
This class contains many additional hints. Refer to the official Microsoft documentation for the full reference.