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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -