I have to update every row in a Sql Server table with about 150,000 records using entity framework. To reduce the amount of hits the server takes, I would like to do this in separate batches of 1000 rows. I need entity framework to:
- Select the first 1000 rows from the DB.
- Update those rows.
- Call SaveChanges() method.
- Get next 1000 rows.
- Repeat.
Whats the best way to achieve this?
I'm using entity framework 4 and SQL Server 2012.