C
C#5mo ago
botcute

Cascading delete from child to parent

I have an entity like this: public class A{ public Guid Id; public Guid Bid; } public class B{ public Guid Id; } How can I make so that B get deleted when A get deleted
5 Replies
joy
joy5mo ago
Cascade Delete - EF Core
Configuring cascading behaviors triggered when an entity is deleted or severed from its principal/parent
botcute
botcuteOP5mo ago
Yes, but It doesn't seem to have anything about cascading delete in a one way relationship
joy
joy5mo ago
Well why use a one-way relationship if you need cascading delete?
botcute
botcuteOP5mo ago
I was trying to find out a way to delete a utility class that can be used by other class but have no reference to the owner class
joy
joy5mo ago
Mmm, have you tried using Fluent API to setup your relationship. I know it has a .OnDelete method maybe that could work?
Want results from more Discord servers?
Add your server