How to Extend the Orders Runtime
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
You can customize the behavior of the Orders System by extending the Orders System classes and overriding methods of some of the Orders classes.
You can extend the Orders runtime classes in the following ways:
Derive a new class from an Orders class.
Add a new property to an Orders class by using the weakly-typed property indexer that each Orders class provides.
The following table presents the advantages and disadvantages of each way of extending the Orders runtime classes.
Extension option |
Advantages |
Disadvantages |
---|---|---|
Derive a new class |
|
|
Add a new property |
|
|
From the integration side (CS Adapters) there are advantages and disadvantages to each way of extending the Orders runtime classes as well, as shown in the following table.
Extension option |
Advantages |
Disadvantages |
---|---|---|
Derive a new class |
|
|
Add a new property |
|
|
The following procedures introduce the high-level tasks that you must perform to extend the Orders System. The documentation in the section Extending the Orders Runtime contains more detailed instructions for completing these procedures.
To extend an Orders System class
Determine which Orders class or classes you will extend.
Write the application code to define the derived classes.
For more information about how to create a new class, see How to Derive a New Orders Class.
Create or modify the database table definitions to store the classes and properties that you are adding.
You can create or modify the database tables manually by using SQL Server management tools. Alternatively, you can use the Order Mapping tool to create or modify the database tables. For more information about how to use the Order Mapping tool, see How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage.
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.
Generate new stored procedures for the database and apply the stored procedures.
For more information about generating the stored procedures, see How to Generate SQL Tables and Stored Procedures for Orders Mapped Storage.
Update the mapping between runtime objects and the pipeline dictionaries to include the mappings for 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.
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.
Write the site code that uses the extended classes.
To add a weakly-typed indexer property to an Orders System class
Determine what additional data you have to associate with an instance of an Orders class.
Choose a name for the new weakly-typed indexer property.
Note
Confirm that the name that you choose has not already been used. The compiler will not warn you if you reuse a name.
Write the site code to use the weakly-typed indexer property.
For more information about how to use weakly-typed indexer properties, see How to Add a Weakly Typed Indexer Property to an Orders Class.
You do not have to modify the definition of the class to use a weakly-typed indexer property.
If you want to store the value of the weakly-typed indexer property in a database column, update the database schema and update the OrderObjectMappings.xml file to map the weakly-typed indexer property to the database column. For example, you might do this if you will search the database using this value.
For more information about how to update the mapping between objects and the database, see Mapping Purchase Orders to the Database.
To override a method on an Orders System class
Determine which method or methods that you will override.
For more information about the methods that you can override, see Overrideable Orders Methods.
Write the application code to implement your version of the method.