共用方式為


Types in the Microsoft Dynamics CRM SDK 2013

 

Applies To: Dynamics CRM 2013

This topic describes the types used in Microsoft Dynamics CRM.

Type mapping between versions

Since the release of Microsoft Dynamics CRM 2011, the programming model has been changed to use native .NET types whenever possible. The following table shows the mapping between the defined type for an entity attribute, the type that is used in a record, and the type that was used in Microsoft Dynamics CRM 4.0.

AttributeTypeCode

New type

Microsoft Dynamics CRM 4.0 type

AttributeTypeCode.BigInt

long

N/A

AttributeTypeCode.Boolean

bool 

CrmBoolean

AttributeType.CalendarRules

EntityCollection or CalendarRules[]

DynamicEntity[] or calendarrule[]

AttributeType.Customer

EntityReference

Customer

AttributeType.DateTime

System.DateTime

CrmDateTime

AttributeType.Decimal

decimal 

CrmDecimal

AttributeType.Double

double 

CrmFloat

AttributeType.EntityName

string

Attributes with ObjectTypeCode in DisplayMask

AttributeType.Integer

int

CrmNumber

AttributeType.Lookup

EntityReference

Lookup

AttributeType.ManagedProperty

BooleanManagedProperty

N/A

AttributeType.Memo

string 

System.String

AttributeType.Money

 Money

CrmMoney

AttributeType.Owner

EntityReference

Owner

AttributeType.PartyList

 EntityCollection or ActivityParty[]

activityparty[] or DynamicEntity []

AttributeType.Picklist

OptionSetValue

Picklist

AttributeType.Uniqueidentifier (Formerly PrimaryKey)

System.Guid

Key

AttributeType.String

string

System.String

AttributeType.State

OptionSetValue or enumeration generated for the entity state

EntityNameStateInfo

AttributeType.Status

OptionSetValue 

Status

AttributeType.Uniqueidentifier

System.Guid

UniqueIdentifier

AttributeType.Virtual

Not used in records.

Not used in records.

Other type changes

The following table lists other notable type changes that were not listed in the table above.

Old type

New type

DynamicEntity

Microsoft.Xrm.Sdk.Entity

For more information, see Use the late bound entity class in code.

CrmAttributeType Class (MetadataService)

Microsoft.Xrm.Sdk.Metadata.AttributeTypeCode

Moniker Class (CrmService)

Microsoft.Xrm.Sdk.EntityReference

 SecurityPrincipal Class (CrmService)

Microsoft.Xrm.Sdk.EntityReference

See Also

Use Microsoft Dynamics CRM 2013 services in code
The programming models for Microsoft Dynamics CRM 2013
Upgrade your code from Microsoft Dynamics CRM 2011 to Microsoft Dynamics CRM 2013