共用方式為


Entity Class

Definition

Represents an instance of an entity (a record).

public ref class Entity : System::Runtime::Serialization::IExtensibleDataObject
[System.Runtime.Serialization.DataContract(Name="Entity", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")]
public class Entity : System.Runtime.Serialization.IExtensibleDataObject
[<System.Runtime.Serialization.DataContract(Name="Entity", Namespace="http://schemas.microsoft.com/xrm/2011/Contracts")>]
type Entity = class
    interface IExtensibleDataObject
Public Class Entity
Implements IExtensibleDataObject
Inheritance
Entity
Attributes
Implements

Remarks

Entity is the base class for all types of entities in Microsoft Dynamics 365. You use this class for both early and late bound programming.

Constructors

Entity()

Initializes a new instance of the Entity class.

Entity(String, Guid)

Initializes a new instance of the Entity class.

This was introduced with Microsoft Dynamics CRM Online 2015 Update 1 and cannot be used with earlier versions.

Entity(String, KeyAttributeCollection)

Initializes a new instance of the Entity class.

This was introduced with Microsoft Dynamics CRM Online 2015 Update 1 and cannot be used with earlier versions.

Entity(String, String, Object)

Initializes a new instance of the Entity class.

This was introduced with Microsoft Dynamics CRM Online 2015 Update 1 and cannot be used with earlier versions.

Entity(String)

Initializes a new instance of the Entity class setting the entity name.

Properties

Attributes

Gets or sets the collection of attributes for the entity.

EntityState

Gets or sets the state of the entity.

ExtensionData

Gets or sets the structure that contains extra data.

FormattedValues

Gets of sets the collection of formatted values for the entity attributes.

HasLazyFileAttribute

For internal use only.

Id

Gets or sets the ID of the record represented by this entity instance.

Item[String]

Provides an indexer for the attribute values.

KeyAttributes

Gets or sets the key attributes.

LazyFileAttributeKey

For internal use only.

LazyFileAttributeValue

For internal use only.

LazyFileSizeAttributeKey

For internal use only.

LazyFileSizeAttributeValue

For internal use only.

LogicalName

Gets or sets the logical name of the entity.

RelatedEntities

Gets or sets a collection of entity references (references to records).

RowVersion

Gets or sets the row version

Methods

Contains(String)

Checks to see if there is a value present for the specified attribute.

GetAttributeValue<T>(String)

Gets the value of the attribute.

GetFormattedAttributeValue(String)

Gets the formatted value of the attribute.

GetRelatedEntities<TEntity>(String, Nullable<EntityRole>)

Gets the collection of related entity instances for the specified relationship.

GetRelatedEntity<TEntity>(String, Nullable<EntityRole>)

Gets the related entity instance for the specified relationship.

SetAttributeValue(String, Object)

Sets the value of an attribute.

SetRelatedEntities<TEntity>(String, Nullable<EntityRole>, IEnumerable<TEntity>)

Sets the collection of related entity instances for the specified relationship.

SetRelatedEntity<TEntity>(String, Nullable<EntityRole>, TEntity)

Sets the related entity instance for the specified relationship.

ToEntity<T>()

Gets the entity as the specified type.

ToEntityReference()

Gets an entity reference for this entity instance.

TryGetAttributeValue<T>(String, T)

Applies to