How do you filter one to many relationships with flu-NHibernate?
I have a set of objects where they can be set as deleted using the "IsDeleted" flag on the database.
This is fine for a normal set of objects, however, when I have a parent with many children that can have this flag, I would like NHibernate to be able to automatically handle selecting children that have "IsDeleted" set to false.
Is there a way to do this with fluent NHibernate? Or XML mappings that I could add to the fluent view.
thank
+1
source to share
1 answer
This is not something that can be done in mappings, Fluent NHibernate or standard XML. What you need to do is register a DeleteEvent listener. There's a post on NHibernate's FAQ on Soft Deletes that's pretty good.
+1
source to share