DataServiceContext.ChangeState(Object, EntityStates) Method

Definition

Changes the state of the given entity. Note that the 'Added' state is not supported by this method, and that AddObject or AddRelatedObject should be used instead. If the state 'Modified' is given, calling this method is exactly equivalent to calling UpdateObject. If the state 'Deleted' is given, calling this method is exactly equivalent to calling DeleteObject. If the state 'Detached' is given, calling this method is exactly equivalent to calling Detach. If the state 'Unchanged' is given, the state will be changed, but no other modifications will be made to the entity or entity descriptor associated with it.

public virtual void ChangeState (object entity, Microsoft.OData.Client.EntityStates state);
abstract member ChangeState : obj * Microsoft.OData.Client.EntityStates -> unit
override this.ChangeState : obj * Microsoft.OData.Client.EntityStates -> unit
Public Overridable Sub ChangeState (entity As Object, state As EntityStates)

Parameters

entity
Object

The entity whose state to change.

state
EntityStates

The new state of the entity.

Applies to