Поделиться через


SerializationBindings Element

The SerializationBindings element in the Web.config file identifies how to access customized objects that were created in one version of your Commerce Server application from a later version of your Commerce Server application.

Put the SerializationBindings element within the orders element.

The SerializationBindings element is a container for SerializationBinding elements.

SerializationBinding Element

The SerializationBinding element defines a mapping between an obsolete Orders class and the class that replaces the obsolete class. When Commerce Server retrieves data about an instance of an obsolete class from the database, it calls the deserialization constructor for the new class to create an instance of the object. The deserialization constructor for the new class must be able to deserialize objects of the old class. The old and new classes could have different names, or they could have the same name but belong to different versions of the assembly in the Global Assembly Cache (GAC).

The following table lists the attributes of the SerializationBinding element.

Attribute

Data Type

Description

OldType

String

The fully qualified name of the class to replace, including the assembly.

NewType

String

The fully qualified name of the class that replaces the old class, including the assembly.

Example

For this example, assume that you derived a new class named ExtBasket version 1.0 from the core Orders Basket class. In the second version of your application, you updated your ExtBasket class and it became version 2.0. In the current version of your application, you created a newer class named NewExtBasket version 1.0 from the core Orders Basket class. The following XML sample illustrates how you would use the SerializationBindings element of the Web.config file to indicate that data about an ExtBasket version 3.0 and data about an ExtBasket version 2.0 should be deserialized using the deserialization constructor for the NewExtBasket version 3.0 class.

<SerializationBindings>
    <!-- Map ExtBasket Version 1.0 to NewExtBasket Version 3.0 -->
    <SerializationBinding
        OldType="CommerceServices.Orders.ExtRuntime.ExtBasket,
            OrdersExtRuntime, Version=1.0.0.0, Culture=neutral,
            PublicKeyToken=31bf3856bc364e35"
        NewType="CommerceServices.Orders.ExtRuntime.NewExtBasket,
            OrdersExtRuntime, Version=3.0.0.0, Culture=neutral,
            PublicKeyToken=31bf3856bc364e35"/>
    <!-- Map NewExtBasket Version 2.0 to NewExtBasket Version 3.0 -->
    <SerializationBinding
        OldType="CommerceServices.Orders.ExtRuntime.ExtBasket,
            OrdersExtRuntime, Version=2.0.0.0, Culture=neutral,
            PublicKeyToken=31bf3856bc364e35"
        NewType="CommerceServices.Orders.ExtRuntime.NewExtBasket,
            OrdersExtRuntime, Version=3.0.0.0, Culture=neutral,
            PublicKeyToken=31bf3856bc364e35"/>
</SerializationBindings >

See Also

Other Resources

Web.Config Configuration Settings