In my ClassMap I only want to load a property when it satifies a condition. This is the code I use now:
References<MyObject>(x => x.Property).ForeignKey("RecordId");
I’d like to add a Where clause to this: only load x.Property when a value in the database is zero, something like this:
References<User>(x => x.Property).ForeignKey("RecordId").Where("Removed = 0"); // Where Removed is a column of the user table
But this doesn’t work unfortunately. Does someone knows an equivalent for this?
In the
ClassMapclass I’ve added aWhereclause:Note: You need to use aliases in the
Whereclause, otherwise it goes wrong.