So, I have a nice domain model built. Repositories handle the data access and what not. A new requirements has popped up that indicates that reasons need to be logged with deletes. Up until now, deletes have been fairly simple => Entity.Children.Remove(child). No internal change tracking was happening as my ORM tool was handling state management. However, I'm not sure exactyl how to handle this.
1) I could keep a deleted children collection in the parent entity and pull the change tracking out of nHibernate and handle it myself.
2) ??????
Ok, this sounds crazy and I'm going to take another shot at this -- even though I might be spanked for bad nHibernate usage. Before you delete, why don't you select the children that are going to be deleted (you already have their ids correct?) and do a transformation into whatever entity your going to be using to log your deletes to a table. Add the reason to the entities and save them -- then proceed with your deletes. Best part, you can use a generic entity i.e. "auditInfo" for the result of the transformation, and you can do it within a transaction so you can rollback everything if something fails! OK, maybe crazy but creative right?