views:

775

answers:

1

I have a set of entities where they could possibly be set as deleted using an "IsDeleted" flag in the database.

This is fine for the normal set of entities, however when I have a parent with many child entities that may have this flag I would like NHibernate to be able to automatically handle selecting the child entities that have "IsDeleted" set to false.

Is there anyway to do this with fluent-NHibernate? Or the XML mappings that I could add view fluent.

Thanks

+1  A: 

This is not something that can be done in the mappings, Fluent NHibernate or standard XML. What you need to do is register a DeleteEvent listener. There's a post on the NHibernate FAQ on Soft Deletes that's very good.

James Gregory