Show TOC

Update OperationsLocate this document in the navigation structure

Update an ODataEntity using the ScheduleUpdateEntity method on the ODataStore.

Use the DeepCopy() method to make a real copy (as opposed to a reference copy) of an entity. Make the necessary updates on the real copy of the ODataEntity. This ensures the original entity remains intact and the app maintains a consistent state, even if the update operation fails (network disconnects, server error, and so on).
  1. Create a deep copy of an existing entity to a temporary ODataEntity variable.
  2. Update the properties of the temporary ODataEntity variable (copiedEntity).
  3. Call the ScheduleUpdateEntity method on the ODataStore. Await on the Response property.
    Note DeepCopy() only makes a shallow copy of any child objects (if present). For example, if your ODataEntitySet is created using the $expand option, then you have parent and child entities (SalesOrder and SalesOrderItems). Performing a DeepCopy() makes a deep copy of the parent object and a shallow copy of the child object.
var copiedEntity = entity.DeepCopy();            
copiedEntity.Properties["Name"].Value = newName;

var execution = Store.ScheduleUpdateEntity(copiedEntity);
await execution.Response;