EntityState Enum

Definition

Indicates the state of an entity as tracked by the OrganizationServiceContext and indicates to the server the operation that should be performed for a related entity.

public enum class EntityState
[System.Runtime.Serialization.DataContract(Name="EntityState", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public enum EntityState
[<System.Runtime.Serialization.DataContract(Name="EntityState", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type EntityState = 
Public Enum EntityState
Inheritance
EntityState
Attributes

Fields

Name Value Description
Unchanged 0

The entity is unchanged since the last call to SaveChanges(). Value = 0.

Created 1

The entity was created since the last call to SaveChanges(). Value = 1.

Changed 2

The entity was changed since the last call to SaveChanges(). Value = 2.

Remarks

The OrganizationServiceContext sets this value after the SaveChanges() method is called and uses this value to track changes to entities. You can also set this value to Changed for a related entity to indicate to the service context that the related entity has been changed and that those changes need to be passed to the server. The service context sends changes to the server when the SaveChanges() method is called.

Applies to