I have the following simple OrmLite select statement:
SpiderUser lSpiderUser = db.Select<SpiderUser>(
su => su.WindowsUserName == vWindowsUserName).SingleOrDefault();
(The variable 'db' is of type IDbConnection).
I would like this query to run using NoLock. Ormlite from version 5.7 has 'SqlServerTableHint.NoLock', but I do not understand how to include this hint in the above query.
Please help...
OrmLite's SqlServerTableHint are only for table joins.
You can customize the generated SQL using a Typed SqlExpression, e.g:
var q = db.From<SpiderUser>()
.Where(su => su.WindowsUserName == vWindowsUserName)
.WithSqlFilter(sql => $"{sql} WITH (NOLOCK)");
var lSpiderUser = db.Single(q);