4

Can anyone suggest me how to deal with batch updates using Entity Framework?

For ex: Updating a field for a list (List) of between 100 and 1000 Id's, which the primary key. Calling each update separately seem to be to much overhead and takes a long time.

legoscia
  • 38,687
  • 22
  • 110
  • 157

1 Answers1

1

Until you call SaveChanges() none of the data is updated in the database so you can make how many changes you'd like.

You can take a look at a Unit of Work design pattern if you want a more structured way of saving changes to the database.

Adrian Hristov
  • 1,817
  • 2
  • 15
  • 21
  • Thanks for reply..But Adrian did you get my point? i know that until i call SaveChanges() nothing is updated to database. what i need all about batch update. – Hemanth Vanal Jul 04 '14 at 07:13
  • Hi, you can check this thread out http://stackoverflow.com/questions/12751258/batch-update-delete-ef5 hope it answers some of your questions – Adrian Hristov Jul 04 '14 at 07:20