C
C#12mo ago
v0fbu1vm

DeleteBehavior?

I'm always confused which DeleteBehavior to assign when configuring my Entities. Can someone please explain to me?
2 Replies
v0fbu1vm
v0fbu1vmOP12mo ago
For instance here
builder.HasOne(e => e.Organization)
.WithMany(e => e.Members)
.OnDelete(DeleteBehavior.Cascade);
builder.HasOne(e => e.Organization)
.WithMany(e => e.Members)
.OnDelete(DeleteBehavior.Cascade);
how do I know which entity is going to get effected. What I mean is that, let's say an organization is deleted, will all the members be deleted. Or does this mean, if a member is deleted, the organization will be deleted?
this_is_pain
this_is_pain12mo ago
where is the foreign key implemented, Member.OrganzationId? i would say yes to first question, no to second

Did you find this page helpful?