CatalogContext Class (BCL)

The CatalogContext class provides a context for interacting with the Commerce Server 2002 Product Catalog System. In the Commerce Server 2002 .NET Application Framework implementation, this wraps a CatalogManager object.

System.Object
   Microsoft.CommerceServer.Runtime.Catalog.CatalogContext

Protected Instance Constructor

Constructor Description
Constructor(DebugContext) Creates a new instance of the CatalogContext class with the specified DebugContext object.

 

Public Instance Methods

Method Description
Dispose Releases resources used by this object.
GetCatalog(String) Gets the ProductCatalog object for the catalog with the specified name.
GetCatalogs(String, String, CatalogSearchOptions, Int32) Searches for catalogs using a TSQL query. All properties of all matching records are returned.
GetCatalogs(String, String, CatalogSearchOptions) Searches for catalogs using a TSQL query. All properties of all matching records are returned.
GetCatalogs(String, String) Searches for catalogs using a TSQL query. All properties of all matching records are returned.
GetCatalogs(String) Searches for catalogs using a TSQL query. All properties of all matching records are returned.
GetDefinitionProperties(String) Gets the properties for a specific catalog definition.
GetEnumerationPropertyValues(String) Returns all possible values for a catalog property of type CatalogDataType.Enumeration.
GetPropertyAttributes(String) Gets the attributes for a specific catalog property.
Refresh Refreshes the Product Catalog System. Ensures that the property caches are coherent with the current design-time view of the catalog.
SetJoinTable(String, String, String, CatalogJoinType) Sets the join table information. The join table information is in effect for the lifetime of the CatalogContext object.

 

Public Instance Properties

Property Description
CachingEnabled True if caching is enabled, otherwise False.

Default is False.

CatalogNames Gets the complete list of catalogs known to the Product Catalog System as an array of catalog names.
CatalogSets Returns the (cached) CatalogSetCollection object that contains information about all the catalog sets in the Commerce Server Product Catalog System.
CategoryDefinitionNames Gets the names of all category definitions defined in the Product Catalog System.
DebugContext Gets the DebugContext object that this object is using to log trace messages, and so forth.
DefaultAnonymousCatalogSet Returns the catalog collection for the configured default anonymous catalog set.
DefaultAuthenticatedCatalogSet Returns the catalog collection for the configured default authenticated catalog set.
ProductDefinitionNames Gets the names of all product definitions defined in the Product Catalog System.
PropertyNames Gets the names of all properties defined in the Product Catalog System.

 

Public Static (Shared) Methods

Method Description
CreateFromConnectionString(String, DebugContext) Creates a CatalogContext object that will run against the catalog database specified in the ADO connection string.

 

Protected Instance Methods

Method Description
CheckState Verifies that the object has not already been disposed.
Dispose(Boolean) Releases the unmanaged resources used by this class. If this class is not sealed, derived classes can override this method to dispose of its own resources.

 

Remarks

The CatalogContext, ProductCatalog, Product, and Category objects implement most of their functionality as virtual methods that may be overridden in a subclass (or an entirely new implementation may be provided). Subclassing also allows for adding information to the data sets before they are returned (for example, inventory levels).

The pattern to implement this is to subclass the CatalogContext object, and provide a static factory method similar to CreateFromConnectionString and CreateFromCommerceSiteName that initializes and returns a new CatalogContext subclass instance. This instance can then be placed into the CommerceContext.CatalogSystem property for use on the site. The subclass must provide an implementation for the GetCatalog methods. However, you can no longer use:

ProductCatalog catalog = new Catalog(string name)

But you can use:

ProductCatalog catalog = CommerceContext.Current.CatalogContext.GetCatalog(string name);

Requirements

Namespace: Microsoft.CommerceServer.Runtime.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: Microsoft.CommerceServer.Runtime.dll

Copyright © 2005 Microsoft Corporation.
All rights reserved.