NHibernate mapping not adding ON DELETE CASCADE option to foreign key reference?

Nbernate can only generate on delete cascade constraints on inverse collections.

Nbernate can only generate on delete cascade constraints on inverse collections. Example for your domain: ...

To supplement the accepted answer, here's how you'd do it with Fluent Nbernate: public class MovieMap : ClassMap { public MovieMap() { ... HasMany(c => c. Showings) .Inverse() . KeyColumn("Foo") .Cascade.All() .

ForeignKeyCascadeOnDelete() // here's the magic . ForeignKeyConstraintName("FK_Movie_Showing"); // this is optional - name is autogenerated otherwise.

Nbernate's cascade setting does not generation cascading foreign keys. It controls actions Nbnerate will take when a session is flushed. Also, it's very unusual for the many side of the relationship to cascade deletes to the one side.

Your mapping would delete a related Movie and Theater when a Showing is deleted.

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