Free Nibernate putting a where clause in a mapping

I have two objects, a parent and a child list. In my current nhibernate mapping for the parent, I want to load a list of children.

However, I want it to be conditional, the column in the child table is called "IsDeleted", and I want to return only those where "IsDeleted" is false.

Can I customize the display for this? If not, can this be done only in standard nhibernate?

thank

+5
source share
1 answer

Yes, you can use the Where clause in Fluent NHibernate to map this. Sort of:

HasMany(x => x.Children).Where("IsDeleted = 0");

Where SQL, HQL. , , , , .

+11

All Articles