Freigeben über


Programming with the Runtime

With Commerce Server 2009 a new Commerce Foundation has been introduced to program the run-time environment. Please refer to the Commerce Foundation sections of the documentation for the new unified programming model. Most of the Commerce Server Core Systems systems have distinct APIs for run time versus management, where a run-time API refers to an API invoked in the course of a customer using a Commerce Server Core Systems Web application, and where a management API refers to an API invoked from, for example, a business management application such as the Marketing Manager, used by a business user tasked with helping run the Web application.

The exceptions to this rule are the Catalog System and the Inventory System, which in addition to having a single API for both run-time and management use, also have a single entry point in that the Inventory System API is accessed through the Catalog System API.

The run-time classes for the other Commerce Server Core Systems systems, and the various run-time infrastructure classes that they share, are all found within the Microsoft.CommerceServer.Runtime namespace and its subordinate namespaces. Specifically, the namespaces for the run-time classes associated with the Marketing System, the Orders System, and the Profiles System are Microsoft.CommerceServer.Runtime.Marketing, Microsoft.CommerceServer.Runtime.Orders, and Microsoft.CommerceServer.Runtime.Profiles, respectively.

An important class for programming with the run-time APIs, found within the Microsoft.CommerceServer.Runtime namespace, is the CommerceContext class. This class, and specifically its Current property, is the entry point into the entire run-time API, and has properties that are the context objects for the various Commerce Server Core Systems systems, which in turn serve as the entry points into the run-time APIs for those systems:

  • The CatalogSystem property is of type CatalogContext, which serves as the entry point for the combined run-time and management API for both the Catalog System and the Inventory System.

    Note

    The CommerceContext class also includes the GetCatalogsForUser method, which returns the set of catalogs appropriate for the current user. For example: ReadOnlyStringCollection catalogs = CommerceContext.Current.GetCatalogsForUser();

  • The OrderSystem property is of type OrderContext, which serves as the entry point for the run-time API for the Orders System.

    For example: order = CommerceContext.Current.OrderSystem.GetPurchaseOrder(userId, orderIdGuid);

  • The ProfileSystem property is of type ProfileContext, which serves as the entry point for the run-time API for the Profiles System.

    For example: ProfileContext profileSystem = CommerceContext.Current.ProfileSystem;

  • The TargetingSystem property is of type TargetingSystemInfo, which serves as the entry point for the run-time API for the Marketing System.

See Also

Other Resources

Agent Mode Programming

Local Mode Programming

Understanding the Different Types of Commerce Server APIs

Developing with the Multi-Channel Commerce Foundation