Partager via


Classes Element (OrderObjectMappings.Xml File)

The Classes element in the OrderObjectMappings.xml file describes the PurchaseOrder class and any classes that the PurchaseOrder class references, if these classes contain data that you want to store in the database.

The Classes element is a child of the StorageMap element, and is required.

The Classes element contains the following elements: the Class element and the CollectionRelationships element.

Class Element

The Class element identifies a class in the Microsoft.CommerceServer.Runtime.Orders namespace that contains data to be stored in the database when an instance of a PurchaseOrder object is saved. This element is required.

The Class element contains the following elements: the Property element and the WeaklyTypedProperty element.

The following table lists the attributes of the Class element.

Attribute

Data Type

Description

Name

String

The name of the class.

This attribute is required.

Property Element

The Property element identifies a property of a class. You need to add a Property element only for properties that contain data that will be stored in the database. This attribute is required.

The following table lists the attributes of the Property element.

Attribute

Data Type

Description

Name

String

The name of the property.

This attribute is required.

WeaklyTypedProperty Element

The WeaklyTypedProperty element identifies a weakly-typed indexer property of a class. You need to add a WeaklyTypedProperty element only for properties that contain data that will be stored in the database. This attribute is optional.

The following table lists the attributes of the WeaklyTypedProperty element.

Attribute

Data Type

Description

Name

String

The name of the property.

This attribute is required.

CollectionRelationships Element

The CollectionRelationships element is a container for CollectionRelationship elements. This element is optional.

CollectionRelationship Element

The CollectionRelationship element defines a one-to-many relationship between two classes that are mapped to the database. This element is required.

The following table lists the attributes of the CollectionRelationship element.

Attribute

Data Type

Description

Name

String

The name of the relationship.

This attribute is optional.

ParentClass

String

The name of the class that contains instances of the child class. The value of this attribute must match the value of the Name attribute of a Class element.

This attribute is required.

ParentProperty

String

The name of the property in the parent class that contains instances of the child classes. The value of this attribute must match the value of the Name attribute of one of the Property elements of the class.

This attribute is required.

ChildClass

String

The name of the class that is nested the parent class. The value of this attribute must match the value of the Name attribute of a Class element.

This attribute is required.

Example

<StorageMap>
  ...
  <Classes>
    <Class Name="PurchaseOrder">
      <Property Name="OrderGroupId"/>
      <Property Name="Name"/>
      <Property Name="SoldToId"/>
      <Property Name="SoldToAddressId"/>
      <Property Name="LineItemCount"/>
      <Property Name="ShippingTotal"/>
      <Property Name="LastModified"/>
      <WeaklyTypedProperty Name="MessageToRecipient" />
    </Class>
    <Class Name="OrderForm">
      <Property Name="OrderFormId"/>
      <Property Name="OrderGroupId"/>
      <Property Name="Name"/>
      <Property Name="LineItems"/>
      <Property Name="Shipments"/>
    </Class>
    <CollectionRelationship Name="PurchaseOrderOrderForms"
      ParentClass="PurchaseOrder"
      ParentProperty="OrderForms"
      ChildClass="OrderForm"
    />
  </Classes>
  ...
</StorageMap>

See Also

Other Resources

Mapping Purchase Orders to the Database

StorageMap Element (OrderObjectMappings.Xml File)

Orders Runtime Object Model