NHibernate filters don't work with Session.Get
Posted
by Khash
on Stack Overflow
See other posts from Stack Overflow
or by Khash
Published on 2009-03-04T18:39:54Z
Indexed on
2010/04/21
12:03 UTC
Read the original article
Hit count: 295
.NET
|nhibernate
I'm trying to implement a Soft-deletable repository. Usually this can be easily done with a Delete Event listener. To filter out the deleted entities, I can add a Where attribute to my class mapping. However, I also need to implement two more methods in the repository for this entity: Restore and Purge. Restore will "undelete" entities and Purge will hard-delete them. This means I can't use Where attribute (since it block out soft-deleted entities to any access)
I tried using filters instead. I can create a filter and enable or disable it within session to achieve the same result. But the problem is filters don't have any effect on Session.Get method (they only affect ICriteria based access).
Any ideas as to how solve this problem?
Thanks
© Stack Overflow or respective owner