Hello everyone I have a problem I’ll try to describe shortly
In our application we use Nhibernate as ORM, and Fluent Nhibernate for mapping,
and was implemented soft delete for entities that mean
the entity doesn’t remove physically for data base it is just set the property DeletedBy and DeletedDate with values.
And the problem is that when the entities loaded with lazy load the soft deleted entities load too. After entities was loaded I need to filter where DeletedDate is null in each place in code where this entities is called, but this is not good.
How can resolve in general for all entities this problem with lazy load soft deleted?
Can you help me?
Thanks in advance!
I haven’t used Fluent-Hibernate so not sure if it would work for you though but for classic NHibernate:
In the HBM class mapping file put a where clause in :
to return only those entities not logically deleted for every request