Programming with the Runtime APIs
Most of the Commerce Server 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 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 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 systems, which in turn serve as the entry points into the run-time APIs for those systems:
For example: order = CommerceContext.Current.OrderSystem.GetPurchaseOrder(userId, orderIdGuid);
For example: ProfileContext profileSystem = CommerceContext.Current.ProfileSystem;