How should I remove all elements in a DbSet?

后端 未结 6 974
臣服心动
臣服心动 2020-12-04 21:01

What\'s the best way to remove all elements in a System.Data.Entity.DbSet, with Entity Framework 4.3?

6条回答
  •  Happy的楠姐
    2020-12-04 21:37

    If you want to remove all elements without writing any SQL and only execute a Single Db Call

    Entity Framework Extended Library offers a batch delete method.

    context.Users.Delete();
    

提交回复
热议问题