在我的 ClassMap 中,我只想在满足条件时加载一个属性。这是我现在使用的代码:
References<MyObject>(x => x.Property).ForeignKey("RecordId");
我想为此添加一个 Where 子句:仅x.Property
在数据库中的值为零时加载,如下所示:
References<User>(x => x.Property).ForeignKey("RecordId").Where("Removed = 0"); // Where Removed is a column of the user table
但不幸的是,这不起作用。有人知道这方面的等价物吗?