Can EF4 support batch updates?

2019-02-08 13:34发布

问题:

Does Entity Framework v4 support batch updates/inserts so rather than sending >1 command to a db, it can send >1 command to the DB in one go?

Thanks

回答1:

I don't believe that has changed. You have the options of:

  • Stored Procedures
  • Stuff like this article
  • Using T-Sql like in the answer of this question


回答2:

I discovered a good answer to this question here: Paul Welter shows how to use EntityFramework.Extended



回答3:

I believe that can be accomplished by adding multiple Entity to the context and calling save changes.

context.ApplyChanges<T>("Order", obj1);
context.ApplyChanges<T>("Order", obj2);
context.SaveChanges();