How Orders Objects Are Stored in the Database
Commerce Server Core Systems 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 Core Systems accesses the database more frequently for Baskets and OrderTemplates, Commerce Server Core Systems stores Baskets and OrderTemplates differently than it stores PurchaseOrders.
To improve performance, Commerce Server Core Systems serializes Baskets and OrderTemplates into a binary large object (BLOB) before storing them to the database. After Commerce Server Core Systems 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 Core Systems 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 Core Systems 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 Core Systems optimizes the storage of PurchaseOrders for ease of searching, rather than for speed. Commerce Server Core Systems 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 Core Systems 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 Core Systems populates the PurchaseOrder object's properties with the values of the columns that they are mapped to. Commerce Server Core Systems 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
How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage