locked
The entity is read-only and the 'EntityState' property cannot be modified. Use the context to update the entity instead. RRS feed

  • Question

  • Hi, 

    I am trying to update multiple records by using ExecuteMultipleRequest.

    But when I try to change the EntityState, its throwing an error saying "The entity is read-only and the 'EntityState' property cannot be modified. Use the context to update the entity instead."

    entity.EntityState = EntityState.Changed;

    I know it can be updated by using context.UpdateObject but I want to use ExecuteMultipleRequest so that I can update multiple records in one go. 

    Can anyone please suggest me any way to make EntityState readable property?

    Thanks

    Tuesday, September 17, 2013 4:10 PM

Answers

  • It worked for me. 

    Created new instance of Entity and used that to update rather than updating the instance retrieved by using context.

    • Marked as answer by jattscorpion Tuesday, September 17, 2013 4:32 PM
    Tuesday, September 17, 2013 4:29 PM