Поделиться через


How Orders Objects Are Stored in the Database

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Commerce Server stores PurchaseOrders in the database when you call the SaveAsOrder or Save method. It is common for you to retrieve the Basket or OrderTemplate from the database at the beginning of each page of site code, and to store the Basket or the OrderTemplate in the database at the end of each page of site code if it has changed. Because Commerce Server accesses the database more frequently for Baskets and OrderTemplates, Commerce Server stores Baskets and OrderTemplates differently than it stores PurchaseOrders.

To improve performance, Commerce Server serializes Baskets and OrderTemplates into a binary large object (BLOB) before storing them to the database. After Commerce Server serializes the Basket or OrderTemplate, it stores the serialized data in the marshaled_data column of the OrderTemplatesAndBaskets table. Because you cannot search the database on the marshaled_data column, you can also direct Commerce Server to store certain properties of the Basket or OrderTemplate to named columns in OrderTemplatesAndBaskets table. If a column in the OrderTemplatesAndBaskets table has the same name as a property in the Basket or OrderTemplate object, Commerce Server will automatically copy the value of the property to the column when saving a Basket or an OrderTemplate, and copy the value of the column to the property when retrieving a Basket or an OrderTemplate.

Because PurchaseOrders are saved and retrieved less frequently, Commerce Server optimizes the storage of PurchaseOrders for ease of searching, rather than for speed. Commerce Server uses the information from the OrderObjectMappings.xml file to associate properties of the PurchaseOrder object with columns in database tables. When you save a PurchaseOrder, Commerce Server saves the values of the PurchaseOrder's properties in the columns that they are mapped to. When you retrieve a PurchaseOrder from the database, Commerce Server populates the PurchaseOrder object's properties with the values of the columns that they are mapped to. Commerce Server stores properties that you do not explicitly map in a BLOB. Because a PurchaseOrder's properties are mapped to individual columns in database tables, you can mine the purchase order database more easily.

See Also

Other Resources

Orders Mapped Storage

How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage

Mapping Purchase Orders to the Database