C
C#3mo 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
hour
hour3mo ago
Cascade Delete - EF Core
Configuring cascading behaviors triggered when an entity is deleted or severed from its principal/parent
botcute
botcute3mo ago
Yes, but It doesn't seem to have anything about cascading delete in a one way relationship
hour
hour3mo ago
Well why use a one-way relationship if you need cascading delete?
botcute
botcute3mo 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
hour
hour3mo 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