Let’s say that I have and database table called People, and entity People. Let’s say that I need a quick way to remove a subset of people from displaying everywhere in application. So I add IsDeleted column to People table, and set values in that column to 1.
In Entity Framework there’s a mechanism that specifies that for instans of entities with value in column IsDeleted set to 1 shouldn’t be fetched and mapping framework filters data automatically. Is is possible to achieve with NHibernate?
You can create abstract class, e.g.
PeopleBase, from which yourPeopleclass will be derived and map your entity to it.After that you can use discriminator like this (didn’t check for correctness, but it should work):