问问题
784 次
1 回答
2
选项 #1 简单方法:SQL 查询
Session.CreateSQLQuery("select * from YourEntityTable with (readpast) where SomeColumn = :col")
.AddEntity(typeof(YourEntity))
.SetString("col", value)
.UniqueResult<YourEntity>();
选项 #2 需要更多工作:
如果您没有使用 NHibernate.LockMode 之一,则可以将方言的 AppendLockHint() 覆盖为:
public override string AppendLockHint(LockMode lockMode, string tableName)
{
if (lockMode == <lockModeYouWantToSacrificeForThis>)
{
return tableName + " with (readpast)";
}
return tableName;
}
于 2011-02-24T13:15:29.880 回答