mardi 26 avril 2016

Fastest way to set state to modified for entity in entity framework\sqlite

I have a large number of entities for example 10k entities that have all been updated. I need a fast way to change the state and ultimately commit them to the database.

BaseOtiveContext.Entry(Entity).State = EntityState.Modified;

For bulk inserts I can easily achieve very fast results with add range.

BaseOtiveContext.Contacts.AddRange(Entities)

I tried parallel for each for the updated entities but it throws an error as the object in the collection is modified.

Aucun commentaire:

Enregistrer un commentaire