c# - WillCascadeOnDelete without base entity knowing of foreign entity -
i have entity in core application:
public class contact : baseentity { //some properties }
i have entity in plugin (not part of main dll) so:
public class additionalcontactdata { public string somepropertythatisntonthemaincontact { get; set; } public contact contact { get; set;} }
after binding models etc via ef, creates tables foreign keys expect. issue have want able delete contact
entity , cascade down remove additionalcontactdata
. wouldn't issue if contact
know additionalcontactdata
i.e:
hasrequired(m => m.contact) .withoptional(m => m.additionalcontactdata) .willcascadeondelete();
this work (and i'd in normal circumstances)
how can achieve same thing without contact
knowing additionalcontactdata
. possible?
i'm hoping i've been clear enough please let me know if more information required.
assuming, code additionalcontactdata
configuration, remove optional property expression withoptional
:
hasrequired(m => m.contact) .withoptional() .willcascadeondelete();
Comments
Post a Comment