2
4

1 に答える 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 に答える