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
quote from Fabio Maulo:
By design.Filters don't work with Get or Load since they mean: I want load the entity with this ID.
Dynamic filters work with HQL/Criteria and Collection(where enabled for a collection) only when you use explicit joins or, more general, when the QuerySpace of a filter match with the QuerySpace of a query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With