Best way to delete multiple records in a LINQ query?

后端 未结 10 828
暗喜
暗喜 2021-01-07 17:22

What is the best way to remove multiple records in one go with LINQ?

10条回答
  •  旧巷少年郎
    2021-01-07 18:08

    With just Entity Framework I found this to be the tightest code.

    db.PreperProperties.RemoveRange(db.PreperProperties.Where(c => c.preperFk == prpr.id));
    db.SaveChanges();
    

提交回复
热议问题