简体   繁体   中英

Commerce Server 2007 OrderObjectMappings definition error

I am adding 3 new properties to my PurchaseOrder object and have gone through the process of adding the 3 new columns to the database table, updating the PurchaseOrder class and lastly the OrderObjectMappings.xml file to ensure the properties in the class map to the database correctly. It all appears correct but I get the following error when the mapping is attempted by commerce server:

[MappedClassDataMismatchException: Table PurchaseOrders column ConcessionOrder does not match expected column name MarshalledData defined in the mapping.]
Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadFromDataSetHelper(DataSet dataSet, ClassInfo[] dependencyClassList, Int32 depClassListLen, Hashtable[] depInstanceLookup, BinaryFormatter formatter, String filter) +3406
Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadFromDataSet(DataSet dataSet, OrderGroupCollection ogColl) +1080
Microsoft.CommerceServer.Runtime.Orders.POLoader.LoadSearchSet(Guid searchSetId, OrderGroupCollection ogc) +388
Microsoft.CommerceServer.Runtime.Orders.POLoader.Load(String storedProcName, ListDictionary sqlParameters) +458
Microsoft.CommerceServer.Runtime.Orders.OrderContext.GetPurchaseOrdersForUser(Guid userId) +352

ConcessionOrder is one of my new properties and appears correctly mapped in the xml file. Does anyone know of any obvious reason why this could be happening, something I have missed perhaps, another setting elsewhere?

Cheers, John

You might want to check that you updated all locations in the OrderObjectMappings.xml

For example in this node

<ClassTableMap Class="PurchaseOrder" Table="PurchaseOrders">

one of the

<PropertyMap ... /> 

lines might be wrong?

The StorageMap root element of the OrderObjectMapping.xml file has 3 child elements that handle mappings between tables and classes and between table columns and class properties.

TABLES NODE

The Tables element maps each child Table element to a physical database table. Each child Column element is mapped to a physical database field.

CLASSES NODE

The Classes element contains a child Class element that corresponds to each Commerce Server 2007 API class. The out of the box properties and your extensions to the properties list exist as child Property elements.

MAPPINGS NODE

The Mappings element is responsible for mapping each child Table element in the Tables element to a child Class element of the Classes element. This element drives the mapping of a physical database table and its columns to the class and child properties of that class.

In order to extend the PurchaseOrder setup in the OrderObjectMapping.xml file to include your new " ConcessionOrder " property, your file would need to contain modifications to the Tables , Classes and Mappings elements as shown below.

NOTE: I have assumed that you are using a bit field to model the boolean ConcessionOrder property...

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM