Export (0) Print
Expand All

Entity Class

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Base class for all entity types.

System.Object
  System.ServiceModel.DomainServices.Client.Entity

Namespace:  System.ServiceModel.DomainServices.Client
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

[DataContractAttribute]
public abstract class Entity : INotifyDataErrorInfo, 
	IEditableObject, INotifyPropertyChanged, IRevertibleChangeTracking, IChangeTracking

The Entity type exposes the following members.

  NameDescription
Protected methodEntityInitializes a new instance of the Entity class.
Top

  NameDescription
Public propertyEntityActionsGets the list of custom method invocations pending for this entity.
Public propertyEntityConflictGets conflict information for this entity after a submit operation.
Protected propertyEntitySetGets the EntitySet that this Entity is a member of.
Public propertyEntityStateGets the current state of this Entity.
Public propertyHasChangesGets a value indicating whether this entity currently has any pending changes
Public propertyHasValidationErrorsGets a value indicating whether this entity has any validation errors.
Protected propertyIsDeserializingGets a value indicating whether the current entity is currently being deserialized.
Public propertyIsReadOnlyGets a value indicating whether this entity is currently in a read-only state.
Public propertyValidationErrorsGets the collection of validation errors for this entity.
Top

  NameDescription
Protected methodAcceptChangesAccepts the current changes to this Entity and applies the appropriate state transitions.
Protected methodBeginEditBegins editing the Entity.
Protected methodCancelEditCancels any edits made to the Entity since the last call to BeginEdit.
Protected methodCanInvokeActionGets a value indicating whether the specified action can currently be invoked.
Protected methodEndEditCommits the edits made to this entity since the last call to EndEdit.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetIdentityReturns the entity identity, suitable for hashing.
Public methodGetOriginalGets the original state for this entity.
Public methodGetType (Inherited from Object.)
Protected methodInvokeActionCalled to register an action to be invoked for this entity when submitting changes.
Protected methodIsActionInvokedIndicates whether the specified action has been invoked.
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOnActionStateChangedCalled when the invoked action state changes for this entity.
Public methodOnDeserializedCalled after this Entity has been deserialized.
Public methodOnDeserializingCalled when this Entity is being deserialized.
Protected methodOnLoadedCalled when an Entity is loaded into an EntitySet.
Protected methodOnPropertyChangedCalled when an Entity property has changed.
Protected methodRaiseDataMemberChangedCalled from a property setter to notify the framework that an Entity data member has changed.
Protected methodRaiseDataMemberChangingCalled from a property setter to notify the framework that an Entity data member is about to be changed.
Protected methodRaisePropertyChangedCalled from a property setter to notify the framework that an Entity member has changed.
Protected methodRejectChangesReverts all property changes made to this entity back to their original values.
Public methodToStringGets a string representation of the current entity. (Overrides Object.ToString().)
Protected methodUpdateActionStateCalled within the context of an OnActionStateChanged override. This method will raise the appropriate property changed notifications for the properties corresponding to a custom method.
Protected methodValidateProperty(ValidationContext, Object)Indicates whether the specified property value is valid for the specified validation context.
Protected methodValidateProperty(String, Object)Indicates whether the specified value is valid for the specified property of the current entity.
Top

  NameDescription
Public eventPropertyChangedOccurs when an Entity property has changed.
Top

  NameDescription
Explicit interface implemetationPrivate methodIChangeTracking.AcceptChangesAccepts all changes made to this entity.
Explicit interface implemetationPrivate methodIEditableObject.BeginEditBegins editing this entity.
Explicit interface implemetationPrivate methodIEditableObject.CancelEditCancels the edits made to this entity since the last call to BeginEdit.
Explicit interface implemetationPrivate methodIEditableObject.EndEditCommits the edits made to this entity since the last call to BeginEdit.
Explicit interface implemetationPrivate eventINotifyDataErrorInfoErrorsChangedOccurs when the validation errors have changed for a property or for the entire entity.
Explicit interface implemetationPrivate methodINotifyDataErrorInfoGetErrorsGets the validation errors for a specified property or for the entire entity.
Explicit interface implemetationPrivate propertyINotifyDataErrorInfoHasErrorsGets a value that indicates whether the entity has validation errors.
Explicit interface implemetationPrivate propertyIChangeTracking.IsChangedGets a value indicating whether this entity currently has any pending changes.
Explicit interface implemetationPrivate methodIRevertibleChangeTracking.RejectChangesRejects all changes made to this entity.
Top

When you expose an entity on the server through a query operation, a corresponding entity is generated in the client project. The generated entity derives from the Entity class and contains the same properties as the entity class in the server project. Any validation attributes that you apply to the entity on the server will also be applied to the client entity. The generated client entity contains partial methods, such as OnFirstNameChanging where FirstName is the name of a property in the entity. You can implement the partial methods to provide customized code that is executed during specified events. For more information, see Client Code Generation and Customizing Generated Code.

The following example shows how to extend a generated entity class by implementing the partial methods to customize a property value.

using System.ServiceModel.DomainServices.Client;

namespace RIAServicesExample.Web
{
  public partial class Employee : Entity
  { 
    public int TotalOffHours 
    { 
      get { return this.SickLeaveHours + this.VacationHours; } 
    } 
    partial void OnSickLeaveHoursChanged() 
    { 
      this.RaisePropertyChanged("TotalOffHours"); 
    } 
    partial void OnVacationHoursChanged() 
    { 
      this.RaisePropertyChanged("TotalOffHours"); 
    } 
  }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft