Partilhar via


Types Element

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

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, 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 mapped to a pipeline dictionary or a database, 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.

Put the Types element within the orders element.

The Types element is a container for Type elements.

Type Element

The Type element identifies the new class that you created, and, if your new class replaces a core Orders system class, the Type element also indicates which class your new class replaces.

The following table lists the attributes of the Type element.

Attribute

Data Type

Description

Key

String

If your new class replaces a core Orders class that is not an abstract class, this attribute is the name of the core Orders class that it replaces. If your new class does not replace a core Orders class, or if it replaces a core Orders class that is abstract, then this attribute is the name of your new class.

UserTypeName

String

The name of your new class.

AssemblyType

String

The location of the assembly. Valid values are "Local" and "GAC". If the value is "GAC", the assembly is stored in the Global Assembly Cache (GAC). If the value is "Local", the assembly is not stored in the GAC.

NameSpace

String

The namespace that contains the derived class.

Assembly

String

The fully qualified name of the assembly that contains the derived class.

Example

For this example, assume that you derived the class MyLineItem from the LineItem class, derived the class MyPayment from the abstract class Payment, and created a new class CustomClass that is not derived from a core Orders 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="LineItem" UserTypeName="MyLineItem" AssemblyType="GAC"
        NameSpace="MyCompany.CommerceServer.Runtime.Orders"
        Assembly="MyCompany.CommerceServer.Runtime, Version=1.0.0.0,
        Culture=neutral, PublicKeyToken=31bf3856bc364e35"/>
    <Type Key="MyPayment" UserTypeName="MyPayment" AssemblyType="GAC"
        NameSpace="MyCompany.CommerceServer.Runtime.Orders"
        Assembly="MyCompany.CommerceServer.Runtime, Version=1.0.0.0,
        Culture=neutral, PublicKeyToken=31bf3856bc364e35"/>
    <Type Key="CustomClass" UserTypeName="CustomClass" AssemblyType="GAC"
        NameSpace="MyCompany.CommerceServer.Runtime.Orders"
        Assembly="MyCompany.CommerceServer.Runtime, Version=1.0.0.0,
        Culture=neutral, PublicKeyToken=31bf3856bc364e35"/>
</Types>

See Also

Other Resources

Orders Runtime Object Model

Web.Config Configuration Settings

orders Element