Reputation: 753
I have an list of items in my database. I'm using Asp.Net MVC with Entity Framework.
My doubt is:
I have a method that goes to update all items in my database, but with one rule!
I have to select all users in my database then I have to divide all items in my database and update it with the user code.
I think I have to use a foreach
in my users and then I have to go updating my items, correct?
Exists an form to update for example 50 items once and then I fire the db.SaveChanges!
Upvotes: 0
Views: 114
Reputation: 33272
Depending on the user count, this is probably is a sort of operation you better perform from outside the OR/M framework. I don't know EF in the details, so check before if it support out of the box some sort of "bulk operations" otherwise go with a straigth update with a query. Leveraging some so calle micro OR/M can help too.
Upvotes: 1