Partager via


Commerce Foundation CommerceEntity

The Microsoft Multi-Channel Commerce Foundation data model comprises a set of commerce entity models. Every commerce entity is based on the CommerceEntity class. This class encapsulates the name of the model, the properties of the commerce entity, and the relationships to other commerce entities. The ModelName is a string representing the name of the CommerceEntity. In essence, this name represents the type of the commerce entity onto which the operation will be performed.

Dd451270.2a3ad16c-1647-4e31-9326-a73836cd14d0(en-US,CS.90).gif

The Properties collection contains properties represented by key/value pairs. The Properties class property represents a weakly typed collection of key value pairs. All other CommerceEntity strongly typed properties reference the content of the Properties collection through the GetPropertyValue() and SetPropertyValue() methods.

All Commerce Server 2009 commerce entities have a consistent set of intrinsic properties. The Commerce Server 2009 intrinsic properties are:

Name

Data Type

Read-only

Description

Id

String

Yes

A unique key that may be used to access the item within the context of its parent item. The value is generated by Commerce Server. For some commerce entity types Commerce Server 2009 may convert a Commerce Server Id to an alternate value using an algorithm documented in the detailed commerce entity specifications.

DateCreated

DateTime?

Yes

Date the commerce entity was created. Has a value only for commerce entities where Commerce Server supports this property. This property is not automatically populated in Commerce Server 2009. If this property is required for your commerce entity, you must specify it explicitly.

DateModified

DateTime?

Yes

Date the commerce entity was last modified. Has a value only for commerce entities where Commerce Server supports this property. This property is not automatically populated in Commerce Server 2009. If this property is required for your commerce entity, you must specify it explicitly.

ModifiedBy

String

Yes

Optionally specified only for commerce entities that support this. Indicates the user that last modified the commerce entity.

ParentId

String

Yes

Optionally specified for commerce entities that support this. Indicates the unique identifier for this commerce entity's parent.

The CommercePropertyCollection class inherits from the KeyedCollection<> generic class. This generic class allows developers to manipulate commerce entities properties via a collection that acts like if it was a dictionary with all of the conveniences of Add, Remove, etc. KeyedCollection<> has a unique property of serializing as an array when exposed via web services.

Relationships

Relationships are also returned in the Properties collection. The value encapsulates the related item in a CommerceRelationship or CommerceRelationshipList object.

The CommerceRelationship represents single one-to-one relationship.

Dd451270.60cb37e3-77c7-45ae-a5cc-42553dfc5634(en-US,CS.90).gif

Property

Description

Target

The Target represents a commerce entity to which a parent is related to.

The CommerceRelationshipList maintains a list of commerce entity CommerceRelationship objects. This represents a one-to-many relationship. Information provided by this class provides paging capabilities on relationships that are exposed in this class.

Dd451270.25002c39-1d7e-453b-b5f0-8304f6fdd425(en-US,CS.90).gif

Property

Description

FirstItemIndex

The FirstItemIndex represents the index of the 0th item returned in the items list.

Items

The Items list represents the returned related commerce entities.

TotalItemCount

The TotalItemCount represents the total number of items Product that exist for the given related item search criteria. This value is returned only if the ReturnTotalItemCount has been set to true in the search criteria.

See Also

Other Resources

Developing with the Multi-Channel Commerce Foundation

Commerce Foundation Presentation

Developing with Concrete Data Types