Product Catalog System Task and Object Mapping from COM to the .NET Framework
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
The Component Object Model (COM).objects for the catalog system no longer exists in Commerce Server 2007. The functionality that is provided by these objects have been replaced by the .NET objects.
The primary class in the Catalog namespace is the CatalogContext object. This class resembles a CatalogManager object in COM, but the searching functionality is now factored out into the separate CatalogSearch object.
If you are not using the .NET Framework, you can create a stand-alone CatalogContext object by calling one of the overloads of the static Create methods. You can initialize the CatalogContext object either by passing the siteName or the URL of the catalog Web service.
From a CatalogContext object, you can obtain access to the rest of the catalog hierarchy. This includes the ProductCatalogProduct, and Category objects. You can obtain a Product object by calling the GetProduct method, and a Category object by calling the GetCategory method.
The primary issues between the Active Server Pages (ASP) and ASP.NET implementations of the catalog include the following:
- In the COM-based model, search results are returned through ActiveX Data Object (ADO) Recordset objects. In the .NET Framework model, they are returned through ADO.NET datasets or other structures such as collections.
In the COM-based model, searching is available through different objects. These include CatalogManager.Search and Category.Search. The scope of the search is determined by which object you searched. In the .NET Framework model, searching is performed through the CatalogSearch object that uses properties that you set to determine the scope of the search.
In the COM-based model, you pass parameters to methods to specify how data is returned, such as sort order and paging settings. In the .NET Framework model, this information is specified in a standard way by providing an instance of the CatalogSearchOptions object.The COM-based model contains a separate object for obtaining a catalog collection for a user profile. In the .NET Framework model, this functionality is exposed by the CommerceContext object.
Object Mapping
The .NET types in the following table are in the Microsoft.CommerceServer.Catalog namespace unless otherwise noted:
COM |
.NET Framework |
---|---|
CatalogManager |
|
ProductCatalog |
|
Category |
|
Product |
|
CatalogSets |
|
CatalogToVendorAssociation |
This functionality does not exist in Commerce Server 2007. Use Catalog Manager, or the ProductCatalog class, to extend the catalog metadata to associate a VendorId with each catalog. |
Task Mapping
The following sections contain common coding tasks and show you the COM and the .NET Framework approach to coding the solution.
Accessing the Root Product Catalog System Object
COM |
.NET Framework |
---|---|
Application(MSCSCatalogManager) |
CatalogSystem (for page-level access) CatalogContext for application-level access) Microsoft.CommerceServer.Catalog |
Accessing a ProductCatalog Object for a Specific Catalog
COM |
.NET Framework |
---|---|
CatalogManager.GetCatalog |
Searching for a Catalog or Catalogs
In both the COM and the .NET Framework models, when you search a catalog, you receive a result set that contains information about the catalogs. However, you must call the GetCatalog method to access the ProductCatalog objects themselves.
COM |
.NET Framework |
---|---|
CatalogManager.Catalogs Although this property is defined in the type library as a property, it is accessed more like a method. It enables you to provide parameters for the search clause and other information for how the results should be returned. |
Getting the List of Catalogs for a Specific User by Using the CatalogSets Functionality
COM |
.NET Framework |
---|---|
CatalogSets.GetCatalogsForUser |
This method uses configuration data specified in the <profiles> section of the Web.config file. Also see the Microsoft.CommerceServer.CatalogSets.CatalogSet class. |
Searching for Products or Categories in a Catalog or Across Catalogs
You can search for products or categories using a free-text search or search based on properties.
COM |
.NET Framework |
---|---|
CatalogManager.Search, specifying the catalog or list of catalogs to search. (The CatalogManager.Query and CatalogManager.FreeTextSearch methods are also provided, but Search is the preferred method.) |
Searching a Specific Category for Descendent Products or Categories
COM |
.NET Framework |
---|---|
Category.Search |
The CatalogSearch object, setting both the catalog name and the category name. Set the Recursive property to true to search across all descendants, or to false to search only the immediate children of the category. |
Refreshing Cached Catalog Data
COM |
.NET Framework |
---|---|
The catalog objects themselves do not cache any data. Call the CacheManager.RefreshCache method for each application-level cache that contains catalog data (see the files global_cache_lib.asp and BDRefresh.asp in the Solution Sites for example usage). The global_cache_lib.asp file and the BDRefresh.asp files are both located in the <drive>:\Inetpub\wwwroot\<Solution Site>\include directory. These files are only available if the Retail or Supplier Solution Site has been unpacked. |
Data for a subset of the Product Catalog System properties can be cached by the objects. To update this data, call the Refresh method. You must also update application-level caches that contain catalog data by accessing cache objects from the collection of site caches (Caches) and calling the RefreshSiteCache method on each. |
Joining Catalog Result Sets to an External Table
COM |
.NET Framework |
---|---|
CatalogManager.SetJoinTable |
Use the <catalog> configuration section in the Web.config file to specify the Catalog System to join, or call the SetJoinTable method at application startup. |
Performing a Specification Search in a Catalog
COM |
.NET Framework |
---|---|
ProductCatalog.BeginSpecificationSearch, ProductCatalog.PerformSpecificationSearch, ProductCatalog.GuaranteedSpecificationSearch |
Getting the List of Properties that Can Be Displayed on the Site
COM |
.NET Framework |
---|---|
CatalogManager.Properties This property returns a result set. You can call the result set's Filter method and pass the parameter value DisplayOnSite=1 as a string to obtain the list of properties. |
Pass the parameter value DisplayOnSite=1 as a string to this method to obtain a list of properties. |
Setting the Language of the Catalog Object
COM |
.NET Framework |
---|---|
ProductCatalog.Language This language will be inherited by the category and product objects that are created from the ProductCatalog object. When you obtain a ProductCatalog object from CatalogManager, the ProductCatalog object will be set to the default language of the catalog. |
This language will be inherited by the category and product objects that are created from the ProductCatalog object. When you obtain a ProductCatalog object from CatalogContext, the ProductCatalog object will be set to the CurrentUICulture object if the catalog supports this culture; otherwise, it will be set to the default language of the catalog. |
Getting the List of Properties in a Catalog
COM |
.NET Framework |
---|---|
CatalogManager.Properties(catalogname) |
Accessing a Product in a Catalog
COM |
.NET Framework |
---|---|
ProductCatalog.GetProduct |
Accessing a Category in a Catalog
COM |
.NET Framework |
---|---|
ProductCatalog.GetCategory() |
Accessing the Root Category in a Catalog
COM |
.NET Framework |
---|---|
ProductCatalog.GetCategory() |
Paging Through a List of Root Categories
COM |
.NET Framework |
---|---|
Not supported in the COM API |
Paging Through a List of Root Products
COM |
.NET Framework |
---|---|
Not supported in the COM API |
Getting the Canonical Path of a Catalog Item to the Root
COM |
.NET Framework |
---|---|
Not supported in the COM API |
Getting the Child Products for a Category
COM |
.NET Framework |
---|---|
Category.DescendantProducts |
The GetCategory method returns a category object for the specified category in the current catalog. The ChildProducts property returns a CatalogItemsDataSet that contains the child products. |
Getting the Ancestor Categories for a Product
COM |
.NET Framework |
---|---|
The Product.AncestorCategories property returns a Recordset that contains the ancestor categories. The Recordset also contains the display name for each ancestor category. |
The AncestorCategories property returns the ancestor categories. |
Getting the Parent Categories for a Product
COM |
.NET Framework |
---|---|
The Product.ParentCategories property returns a Recordset object that contains the parent categories. The Recordset object also contains the display name for each parent category. |
The ParentCategories. |
Getting the Ancestor Categories for a Category
COM |
.NET Framework |
---|---|
The Category.AncestorCategories property returns a Recordset object that contains the ancestor categories. The Recordset object also contains the display name for each ancestor category. |
The AncestorCategories property returns the ancestor categories. |
Getting the Parent Categories for a Category
COM |
.NET Framework |
---|---|
The Category.ParentCategories property returns a Recordset object that contains the parent categories and the display name for each parent category. |
The ParentCategories property returns the parent categories. |
Getting the Child Categories for a Category
COM |
.NET Framework |
---|---|
The Category.ChildCategories property returns a Recordset object that contains the child categories. The Recordset also contains the display name for each child category. |
The ChildCategories property returns the child categories. |