Partager via


How to Integrate a Derived Class with the Orders System

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

You can extend the Orders System to add your own attributes or methods to existing classes. The following list presents several example scenarios that could cause you to extend the orders system:

  • Creating a new type of payment. You could derive a new Payment class to handle payments through an online payment system.

  • Enabling integration with other business systems. If your existing business systems require specific information about an order, you could add a new property to an Orders class to obtain and store that information.

  • Gathering additional information about an item. If your company sells monogrammed clothing, you could extend the LineItem class to store the initials to print on each item.

  • Tracking product dependencies. If one product depends on another product, such as a service contract for a stove depends on the stove itself, you could derive a new class from the LineItem class and add a reference to the parent item when the child item is created.

Commerce Server integrates your new class together with the Orders System. For example, if you derive the class MyLineItem from the core LineItem class, you can indicate that the MyLineItem class replaces the LineItem class. By doing this, you make the Orders pipelines and mapped storage use the MyLineItem class instead of the LineItem class. Because the MyLineItem class derives from the LineItem class, properties and methods of the core Orders classes that use LineItem objects will also work with instances of your new class. For example, the LineItemCollection class will contain LineItem objects, which you can cast into MyLineItem objects.

The following procedure provides an overview of the steps that you must perform to derive and integrate a new class. Each step includes a reference to more detailed instructions for completing the step.

To integrate a derived class with the Orders system

  1. In Visual Studio, build a new class library that contains code to derive a new class from an Orders System class, and add your extensions to the derived class. For more information about how to create the new class, see How to Derive a New Orders Class.

  2. Update the mapping between runtime objects and the dictionaries that pipelines use to include the classes and properties that you added. For more information about how to update the mapping between objects and the dictionaries, see How to Modify the OrderPipelineMappings.xml File.

  3. Update the Web.config files to reflect the new classes and files. For more information about the Orders system elements in the Web.config file, see How to Add a Derived Orders Class to the Web.config File.

  4. Update the mapping between runtime objects and the database to include the classes and properties that you added. For more information about how to update the mapping between objects and the database, see Mapping Purchase Orders to the Database.

  5. Modify the database tables to store any properties that you added.

    ms962724.alert_caution(en-US,CS.70).gifImportant Note:

    Do not use the OrderMapping tool to generate an SQL script to create new columns in existing tables. The SQL script that the OrderMapping tool generates includes drop statements that will delete any existing data in the tables.

  6. Generate new stored procedures for the database and apply the stored procedures. For more information about how to generate the stored procedures, see How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage.

    Note

    If you add columns to the BasketGroup table, you must also manually update the following stored procedures to add the new column names: SPI_OrderTemplatesAndBaskets, SPS_OrderTemplatesAndBaskets, SPS_Search_OrderTemplatesAndBasketsByOrderGroupId, SPS_Search_OrderTemplatesAndBasketsByStatusCodeSoldToId, and SPS_Search_OrderTemplatesAndBasketsByStatusCodeSoldToIdName.

  7. If you are using BizTalk Server, you might have to update one or more BizTalk adapters. For more information about how to update BizTalk adapters, see Generating and Using the XSD Files Required by Different Commerce Server Systems.

  8. Deploy the new assembly and mapping files. For more information about how to deploy the assembly and mapping files, see How to Deploy New Orders Assemblies and Mapping Files.

See Also

Other Resources

How to Derive a New Orders Class

How to Modify the OrderPipelineMappings.xml File

How to Add a Derived Orders Class to the Web.config File

Mapping Purchase Orders to the Database

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

How to Deploy New Orders Assemblies and Mapping Files

Extending the Orders Runtime