Bagikan melalui


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

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

When you derive a new class from one of the core Orders classes, you can indicate to Commerce Server that your new class replaces the core Orders class by modifying the Web.config file. For example, if you derive a new class from the LineItem class, you can indicate that your new class replaces the LineItem class. By doing this, you make the Orders pipelines and mapped storage use your new class instead of the LineItem class.

The Types element in the Web.config file identifies custom classes that you add to the core Orders classes. If you derive a new class from one of the core Orders classes and you want Commerce Server to use instances of your new class, you must use the Types element to indicate that your new class replaces the existing class. If you create a new class that is not derived from a core Orders class, and if your new class will be used in a pipeline or persisted to a database by Commerce Server, then you must use the Types element to identify the new class. If you create a new class that is not derived from a core Orders class, and if your new class will not be mapped to a pipeline dictionary or a database, then you do not need to use the Types element to identify the new class.

For example, assume that you derived the class MyLineItem from the core LineItem class, and derived the class MyBasket from the core Basket class. You then created an assembly that contained these new classes, and stored the assembly in the Global Assembly Cache (GAC). The Types section of the Web.config file would contain XML like the following example. (The assembly name and public key tokens would be different.)

<Types>
    <Type Key="Basket" UserTypeName="MyBasket" AssemblyType="GAC"
        NameSpace="MyCompany.CommerceServer.Runtime.Orders"
        Assembly="MyCompany.CommerceServer.Runtime, Version=1.0.0.0,
        Culture=neutral, PublicKeyToken=31bf3856bc364e35"/>
    <Type Key="LineItem" UserTypeName="MyLineItem" AssemblyType="GAC"
        NameSpace="MyCompany.CommerceServer.Runtime.Orders"
        Assembly="MyCompany.CommerceServer.Runtime, Version=1.0.0.0,
        Culture=neutral, PublicKeyToken=31bf3856bc364e35"/>
</Types>

For more information about the Types element, see Types Element.

Note

To make the Orders Web service behave the same as the application, the orders element and all of its attributes and sub-elements must be the same in both the Web.config file for the Orders Web service and the Web.config file for the application.

See Also

Other Resources

Types Element

How to Integrate a Derived Class with the Orders System

How to Modify the Orders Configuration Files