Share via


Mappings Element (OrderObjectMappings.Xml File)

The Mappings element in the OrderObjectMappings.xml file describes the mapping between purchase orders and database tables.

The Mappings element is a child of the StorageMap element. It contains one or more ClassTableMap elements.

ClassTableMap element

The ClassTableMap defines a mapping between a class in the Microsoft.CommerceServer.Runtime.Orders namespace and a database table. You need to add a ClassTableMap element only for classes that contain data that will be stored in the database.

This element is required.

The ClassTableMap element contains one or more PropertyMap elements.

The following table lists the attributes of the ClassTableMap element.

Attribute

Data Type

Description

Class

String

The name of the class that is mapped to a database table. The value of this attribute must match the value of the Name attribute of a Class element. For more information about the Class element, see Classes Element (OrderObjectMappings.Xml File).

This attribute is required.

Table

String

The name of the table that the class is mapped to. The value of this attribute must match the value of the Name attribute of a Table element. For more information about the Table element, see Tables Element (OrderObjectMappings.Xml File).

This attribute is required.

PropertyMap element

The PropertyMap element defines a mapping between a property of the class and a column in the database table. You need to add a PropertyMap element only for properties that contain data that will be stored in the database.

The following table lists the attributes of the PropertyMap element.

Attribute

Data Type

Description

Property

String

The name of the property that is mapped to a column in the table. The value of this attribute must match the value of the Name attribute of a Property or WeaklyTypedProperty element within the class.

This attribute is required.

Column

String

The name of the column that the property is mapped to. The value of this attribute must match the value of the Column attribute of a Table element.

This attribute is required.

Example

<StorageMap>
  ...
  <Mappings>
    <ClassTableMap Class="PurchaseOrder" Table="PurchaseOrders">
      <PropertyMap Property="OrderGroupId" Column="OrderGroupId" />
      <PropertyMap Property="Name" Column="Name" />
      <PropertyMap Property="SoldToId" Column="SoldToId" />
      <PropertyMap Property="SoldToAddressId"
        Column="SoldToAddressId" />
      <PropertyMap Property="LineItemCount" Column="LineItemCount" />
      <PropertyMap Property="ShippingTotal" Column="ShippingTotal" />
      <PropertyMap Property="LastModified" Column="LastModified" />
      <PropertyMap Property=" MessageToRecipient"
        Column="MessageToRecipient" />
    </ClassTableMap>
  </Mappings>
</StorageMap>

See Also

Other Resources

Mapping Purchase Orders to the Database

StorageMap Element (OrderObjectMappings.Xml File)