共用方式為


Entity Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Represents an instance of an entity (a record).

Namespace:   Microsoft.Xrm.Sdk
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.Entity

Syntax

[DataContractAttribute(Name = "Entity", Namespace = "https://schemas.microsoft.com/xrm/2011/Contracts")]
public class Entity : IExtensibleDataObject
<DataContractAttribute(Name := "Entity", Namespace := "https://schemas.microsoft.com/xrm/2011/Contracts")>
Public Class Entity
    Implements IExtensibleDataObject

Constructors

Name Description
System_CAPS_pubmethod Entity()

Initializes a new instance of the Entity class.

System_CAPS_pubmethod Entity(String)

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

System_CAPS_pubmethod 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.

System_CAPS_pubmethod 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.

System_CAPS_pubmethod 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.

Properties

Name Description
System_CAPS_pubproperty Attributes

Gets or sets the collection of attributes for the entity.

System_CAPS_pubproperty EntityState

Gets or sets the state of the entity.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data.

System_CAPS_pubproperty FormattedValues

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

System_CAPS_pubproperty Id

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

System_CAPS_pubproperty Item[String]

Provides an indexer for the attribute values.

System_CAPS_pubproperty KeyAttributes

Gets or sets the key attributes.

System_CAPS_pubproperty LogicalName

Gets or sets the logical name of the entity.

System_CAPS_pubproperty RelatedEntities

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

System_CAPS_pubproperty RowVersion

Gets or sets the row version

Methods

Name Description
System_CAPS_pubmethod Contains(String)

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

System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetAttributeValue<T>(String)

Gets the value of the attribute.

System_CAPS_protmethod GetFormattedAttributeValue(String)

Gets the formatted value of the attribute.

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

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

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

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

Gets the related entity instance for the specified relationship.

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethod SetAttributeValue(String, Object)

Sets the value of an attribute.

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

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

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

Sets the related entity instance for the specified relationship.

System_CAPS_pubmethod ToEntity<T>()

Gets the entity as the specified type.

System_CAPS_pubmethod ToEntityReference()

Gets an entity reference for this entity instance.

System_CAPS_pubmethod ToString()

(Inherited from Object.)

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.

Thread Safety

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

See Also

Microsoft.Xrm.Sdk Namespace
Use the early bound entity classes in code
Use the late bound entity class in code

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright