entity-framework-extended

Bulk insert using EntityFramework Extended

泄露秘密 提交于 2019-12-11 04:01:59
问题 According to this, bulk insert in Entity can be made using the following code: var customers = GetCustomers(); db.Customers.AddRange(customers); db.SaveChanges(); I used SQL Profiler to verify how many insert queries were executed and I saw there was an insert for each element of the list. Why? 回答1: AddRange Add range doesn't perform a BulkInsert, it simply DetectChanges once after all entities are added to the set. The DetectChange method can be VERY slow. See: Entity Framework -

How to Bulk Update records in Entity Framework?

自古美人都是妖i 提交于 2019-11-27 04:26:09
问题 I am trying to bulk update records using Entity Framework. I have tried Entity Framework.Extensions Update method. The Update method is able to bulk update for a set of records with same set of update values. Example: Id - Quantity Record 1 - A - 10 Record 2 - B - 20 Record 3 - C - 30 We can bulk update all the above records by simple calling Records.Update(new => Record { Quantity = 100 }); How can I bulk update each record with different quantity using Entityframework.Extensions or in any