Kopīgot, izmantojot


How to Modify the OrderPipelineMappings.xml File

The OrderPipelineMappings.xml file defines how objects in the Orders System runtime map to entries in the dictionaries that pipelines use.

You modify the OrderPipelineMappings.xml file in a way that resembles the way you modify the OrdersObjectMappings.xml file. First, you change the parent-child collection relationship from the COM class to the managed class, such as from OrderForm.LineItems to LineItem. The following excerpt from the OrderPipelineMappings.xml file was modified to point to the MyLineItem class:

<Class name="OrderForm">
 <property name="OrderFormID" dictionaryKey="orderform_id"/>
...
 <collection name="LineItems" dictionaryKey="items" keyType="SimpleList" referTo="MyLineItem"/>
...
</Class>

The collection tag describes a parent-child collection relationship. The name attribute describes the property name of the collection in the parent. The dictionaryKey attribute indicates the name of the key in the IDictionary to which the collection should map. The keyType attribute indicates the type of legacy Commerce Server Core Systems collection that you should use to hold the contents of the collection; in this case, you are mapping to an ISimpleList. The referTo attribute indicates the class type that is contained in the collection. You change the referTo value to MyLineItem because you are switching to MyLineItem instances.

The pipeline-mapping file also contains class definitions that you use for mapping information. The following is a relevant part of the LineItem class definition, modified to show the new class name and to add the new property. The name to which you map the property can be anything as long as it does not conflict with the name of another property. The convention is to use the older, non-Pascal naming convention when translating into a pipeline context, so that you use the name widget_description_property. You cannot map a property to multiple dictionary keys.

<Class name="MyLineItem">
 <property name="OrderGroupID" dictionaryKey="order_group_id"/>
...
<property name="WidgetDescriptionProperty" dictionaryKey="widget_description_property"/>
 <collection name="ItemLevelDiscountsApplied" dictionaryKey="_itemlevel_discounts_applied" keyType="SimpleList" referTo="DiscountApplicationRecord"/>
 <collection name="OrderLevelDiscountsApplied" dictionaryKey="_orderlevel_discounts_applied" keyType="SimpleList" referTo="DiscountApplicationRecord"/>
</Class>

See Also

Other Resources

What Is a Sample OrderPipelineMappings.xml File?