How to remove all children using linq in sql?

Is there an easy way to remove all child records for an element using Linq in sql?

+5
source share
1 answer

Something like this will work if there is a relationship between the tables:

var parent = // ...
context.Children.DeleteAllOnSubmit(parent.Children);
context.SubmitChanges();
+6
source

All Articles