Setting up Fluent NHibernate one-to-many with cascading deletes using the automapper?

Deletes do not cascade by default in N Set cascading on codeGroup. Codes relationship like this.

Deletes do not cascade by default in N Set cascading on codeGroup. Codes relationship like this: AutoMap. AssemblyOf(new AutomappingConfiguration()) // existing overrides .

Override( map => map. HasMany(c => c. Codes).Cascade.AllDeleteOrphan().Inverse()) And similarly for other relations that you need to be influenced.

Edited by OP: Just needed that ".Inverse()" at the end. Related to this question: key-many-to-one and key-property association: nhibernate won't DELETE items from set.

– roufamatic Oct 25 at 18:58 You're right. AllDeleteOrphan is for one-to-many only, All will go here. – A.. Oct 25 at 19:01 Nope, this isn't working -- An association from the table CodeGroup refers to an unmapped class: System.Collection.Generic.

IList``1MyNamespace. Code, ... – roufamatic Oct 25 at 19:04 OK, this IS one-to-many, so it was correct before, but with different relation mapping. See corrected answer.

Sorry for mess. – A.. Oct 25 at 19:17 Same error.Is there any significance to the message "could not delete collection"? That seems ominous -- it shouldn't be trying to delete a collection, just an entity.

– roufamatic Oct 25 at 20:16.

You might be hitting this issue. Unless you're running 3.2.0Beta2 or later, if you want to cascade deletes you must either: make the child's FK nullable; or create a inverse relationship (that is, the child must have a mapped reference to the parent). As you can see from the ticket this has been longstanding (and much upvoted) issue that has very recently been fixed.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions