How to remove child one to many related records in EF code first database?

后端 未结 5 1971
逝去的感伤
逝去的感伤 2020-12-01 00:57

Well, I have one-to-many related model:

public class Parent
{
    public int Id { get; set; }
    public string Name { get; set; }
    public ICollection<         


        
5条回答
  •  独厮守ぢ
    2020-12-01 01:04

    In EF6 a faster way to do the operation is...

     context.Children.RemoveRange(parent.Children)
    

提交回复
热议问题