C
C#8mo ago
V0FBU1VM

DeleteBehavior?

I'm always confused which DeleteBehavior to assign when configuring my Entities. Can someone please explain to me?
2 Replies
V0FBU1VM
V0FBU1VMOP8mo 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?
Omnissiah
Omnissiah8mo ago
where is the foreign key implemented, Member.OrganzationId? i would say yes to first question, no to second
Want results from more Discord servers?
Add your server