Udostępnij za pośrednictwem


CategoryConfiguration Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Specifies the pre-loaded configuration of a Category object, including it's Child categories and products.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public NotInheritable Class CategoryConfiguration _
    Inherits CatalogItemConfiguration
'Usage
Dim instance As CategoryConfiguration
public sealed class CategoryConfiguration : CatalogItemConfiguration
public ref class CategoryConfiguration sealed : public CatalogItemConfiguration
public final class CategoryConfiguration extends CatalogItemConfiguration

Remarks

Configuration properties for enhanced pre-loading of properties. Used to pre-fetch data for this object and pre-loading category. For instance, it could contain changes and must include the identifying properties.

Specifies the pre-loaded configuration of a Category object, including it's Child categories and products. Configuration of a Product, allows you to specify configuration of variants (ignored for non product family products).

Specifies the view configuration of a Category object, including it's Child categories and products.

Examples

// This method demonstrates usage of the categoy configuration objects
internal void UseCategoryConfiguration(string catalogName, string categoryName)
{
  ProductCatalog productCatalog = this.catalogContext.GetCatalog(catalogName);
  // Use the category configuration object to configure the properties that are
  // initialized in the category object. These properties will be preloaded by the catalog server
  // All other properties will be lazy initialized.
  CategoryConfiguration categoryConfiguration = new CategoryConfiguration();
  categoryConfiguration.LoadChildProducts = true;
  categoryConfiguration.ChildProducts.SearchOptions = new CatalogSearchOptions();
  categoryConfiguration.ChildProducts.SearchOptions.ClassTypes = CatalogClassTypes.ProductClass | CatalogClassTypes.ProductFamilyClass;
  categoryConfiguration.ChildProducts.SearchOptions.SetPaging(1, 20);
  Category category = productCatalog.GetCategory(categoryName, categoryConfiguration);
  // Iterating the Product Collection
  foreach (Product product in category.ChildProducts)
  {
    // Accessing the display name of the product
    Console.WriteLine(product.DisplayName);
  }
  foreach (Category parentCategory in category.ParentCategories)
  {
    // Accessing the display name of the category
    Console.WriteLine(parentCategory.DisplayName);
  }
  // Accessing category relationships
  foreach (CatalogRelationshipsDataSet.CatalogRelationship relationship in category.RelatedCategories.CatalogRelationships)
  {
    Console.WriteLine(relationship.RelationshipName);
    Console.WriteLine(relationship.RelationshipDescription);
  }
} 

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Catalog..::.CatalogItemConfiguration
    Microsoft.CommerceServer.Catalog..::.CategoryConfiguration

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

CategoryConfiguration Members

Microsoft.CommerceServer.Catalog Namespace