Partager via


CatalogRelationshipsDataSet

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

The CatalogRelationshipsDataSet class contains information about the category and product relationships for a catalog item. You can access the DataRowCollection of the dataset’s data table by using the CatalogRelationships property. You can access each row in the collection by using the properties of the CatalogRelationshipsDataSet..::.CatalogRelationship class.

The following table contains the strongly typed properties in this dataset.

Property

Description

CatalogClassTypes

Gets or sets an integer value that specifies the class type of the catalog item. This property is one of the values of the CatalogClassTypes enumeration. The possible values for this property are as follows:

  • 1 - CategoryClass

  • 2 - ProductVariantClass

  • 4 - ProductClass

  • 8 - ProductFamilyClass

DisplayName

Gets or sets a string that specifies the display name of the related item.

ListPrice

Gets or sets a decimal value that specifies the list price of the related item.

Rank

Gets or sets an integer value that specifies the rank of the related item.

RelationshipDescription

Gets or sets a string that specifies the relationship description in the current active language; maximum length is 256 characters. This property returns an empty string if the relationship does not have a description.

RelationshipName

Gets or sets the name of the relationship as a string; maximum length is 128 characters.

TargetCatalogName

Gets the target catalog name for the relationship as a string; maximum length is 85 characters.

TargetCategoryName

Gets the name of the target category for category relationships as a string; maximum length is 128 characters. This property returns null for product relationships.

TargetProductId

Gets the related product identifier for product relationships as a string; maximum length is 256 characters. This property returns null for category relationships.

Constraints

The CatalogRelationshipsDataSet class defines constraints on the RelationshipDescription, RelationshipName, TargetCatalogName, TargetCategoryName, and TargetProductId columns.

Using the CatalogRelationshipsDataSet Class

The following example demonstrates how to access the properties of the CatalogRelationshipsDataSet class.

public static void UseDataset(CatalogContext context, string catalogName, string categoryName)
{
    // Get an existing product catalog.
    ProductCatalog productCatalog = catalogContext.GetCatalog(catalogName);
    // Get a category in the catalog.
    Category category = productCatalog.GetCategory(categoryName);
    CatalogRelationshipsDataSet categoryRelationships = category.RelatedCategories;
    // Get the attributes for the first row of data.
    CatalogRelationshipsDataSet.CatalogRelationship categoryRelationship = categoryRelationships.CatalogRelationships[0];
    string targetCatalog = categoryRelationship.TargetCatalogName;
    string targetCategory  = categoryRelationship.TargetCategoryName;
    string relationshipName = categoryRelationship.RelationshipName;
    string relationshipDescription = categoryRelationship.RelationshipDescription;
          
    // Iterate through the dataset and access the attributes.
    foreach(CatalogRelationshipsDataSet.CatalogRelationship relationship in category.RelatedCategories.CatalogRelationships)
    {
        targetCatalog = relationship.TargetCatalogName;
        targetCategory  = relationship.TargetCategoryName;
        relationshipName = relationship.RelationshipName;
        relationshipDescription = relationship.RelationshipDescription;
    }
}

The CatalogRelationshipsDataSetSchema Class

The CatalogRelationshipsDataSetSchema class provides constants for all the built-in columns in the dataset and defines all the associated methods. The following table contains the associated methods for this class.

Method

Description

IsReadOnlyColumn

Returns true if the columnName in the dataset cannot be updated, or false if the columnName in the dataset can be updated.

IsBuiltInColumn

Returns true if the columnName is a built-in column in the dataset, or false if the columnName is a user-defined property.

See Also

Other Resources

Typed Datasets in the Catalog System

Typed Datasets in the Inventory System