public async Task UpdateEntity(EntityModel update)  {      _context.AttachRange(update.Links);      _condext.Update(update);  }  In this example, I have many-to-many relation between EntityModel and LinkModel. The instance update is not attached to the context and has a list of LinkModel entities with added and removed rows. I want to update the whole list of linked elements in one request to database without comparing added and deleted rows. Is that possible?
Code in the example is working when adding linked elements the first time, but then throws an error about already existing elements in table "EntitiesLinksRelations".
https://stackoverflow.com/questions/66808562/entityframework-how-to-replace-whole-entity-list-in-many-to-many-relation March 26, 2021 at 06:37AM 
没有评论:
发表评论