Condividi tramite


How to Map a Weakly Typed Indexer Property to an Explicit Database Column

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

Weakly typed indexer properties for Baskets and OrderTemplates are mapped to the Orders database differently than they are for PurchaseOrders.

For Baskets and OrderTemplates, you can map a weakly typed indexer property to an explicit column in the database if both of the following conditions are true:

  • The weakly typed indexer property is a property of the top-level class (that is, the Basket class, the OrderTemplate class, or your extended top-level class).

  • The name of the weakly typed indexer property does not start with an underscore character (“_”).

For PurchaseOrders, the first condition does not apply. You can map weakly typed indexer properties of both the top-level class and nested classes to the database, as long as the property’s name does not start with an underscore character (“_”).

Note

To map a weakly typed indexer property that starts with an underscore character to the database, use the Scriptor pipeline component to copy the value of the weakly typed indexer property to a new property whose name does not start with an underscore character.

To map a weakly typed indexer property of a Basket or an OrderTemplate to an explicit database column

  1. Manually modify the database schema to add a column to the OrderTemplatesAndBaskets table for the weakly typed indexer property.

    Note

    The database column must have the same name as the weakly typed indexer property. A column that corresponds to a weakly typed indexer property must not have the not null constraint.

  2. Use SQL Server to edit the following stored procedures to reference the column that you added:

    • SPS_Search_OrderTemplatesAndBasketsByOrderGroupId

    • SPS_Search_OrderTemplatesAndBasketsBySoldToIdOrderGroupId

    • SPS_Search_OrderTemplatesAndBasketsByStatusCodeSoldToId

    • SPS_Search_OrderTemplatesAndBasketsByStatusCodeSoldToIdName

    • SPI_OrderTemplatesAndBaskets

  3. Reset IIS.

To map a weakly typed indexer property of a PurchaseOrder to an explicit database column

  1. If the database already contains data that you do not want to delete, manually modify the database schema to add a column for the weakly typed indexer property.

    Note

    A column that corresponds to a weakly typed indexer property must not have the not null constraint.

  2. Update the OrderObjectMappings.xml file to define which weakly typed indexer property maps to which database column.

  3. Run the Order Mapping tool to create the stored procedures. If you want to create the database schema rather than modify the schema, use the Order Mapping tool to generate the database tables also. For more information about using the Order Mapping tool, see How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage.

  4. Run the script that the Order Mapping tool generated.

  5. Reset IIS.

See Also

Other Resources

How to Add a Weakly Typed Indexer Property to an Orders Class

Mapping Purchase Orders to the Database

Orders Mapped Storage