NHibernate on-delete="cascade" with relationship on many side -


i have object model that:

  • folder - simple structure name etc.
  • file - complex object containing reference folder in contained.

folder doesn't know files , don't want know. relation many-to-one , should known on file's side only.

anyway, rely on database's on delete cascade feature, when remove folder, want files within folder deleted automatically. can't use nhibernate's cascading there no relation folder file.

i know there on-delete="cascade" option <key> element in case of one-to-many relationship, can't find equivalent model - when relation defined on many side.

am doing wrong or need go through , delete files within deleted folder manually?

you try map one-to-many side access="noop". way don't need property in classes still have mapping.

in fluent nhibernate someting this:

hasmany(reveal.member<folder, ienumerable<file>>("_files"))    .keycolumn("column_name")    .access.noop()    .inverse()    .foreignkeycascadeondelete(); 

note: need _files field of type ienumerable<file> in folder class (limitation of fluent nhibernate, can map existing fields or properties). field can null, never used.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -