Share via


CatalogVirtualCatalogRulesDataSet

The CatalogVirtualCatalogRulesDataSet class contains information about all the inclusion and exclusion rules that are defined in the virtual catalog. You can access the DataRowCollection of the dataset’s data table by using the VirtualCatalogRules property. You can access each row in the collection by using the properties of the CatalogVirtualCatalogRulesDataSet..::.VirtualCatalogRule class.

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

Property

Description

CatalogName

Gets or sets a string that contains the name of the base catalog from which this rule comes; maximum length is 85 characters.

CategoryName

Gets or sets a string that contains the category name for category rules; maximum length is 128 characters. This property returns null for all other rules.

DisplayName

Gets or sets a string that contains the display name for the virtual catalog rule.

ProductId

Gets or sets a string that specifies the product identifier for product and variant rules; maximum length is 256 characters. This property returns null if the rule is a category rule.

VariantId

Gets or sets a string that specifies the variant identifier for variant rules; maximum length is 256 characters. This property returns null if the rule is not a variant rule.

VirtualCatalogRuleType

Gets an integer that specifies the type of the rule. This property is one of the values of the VirtualCatalogRuleType enumeration. The possible values for this property are as follows:

  • 1 - IncludeProduct

  • 2 - ExcludeProduct

  • 3 - IncludeCategory

  • 4 - ExcludeCategory

  • 5 - IncludeVariant

  • 6 - ExcludeVariant

If the value of VirtualCatalogRuleType is 3 and the CategoryName property is null, this rule is an IncludeCategory rule.

If the value of VirtualCatalogRuleType is 4 and the CategoryName property is null, this rule is an ExcludeCategory rule.

Constraints

The CatalogVirtualCatalogRulesDataSet class defines a constraint on the CatalogName, ProductId, VariantId, and CategoryName columns.

Using the CatalogVirtualCatalogRulesDataSet Class

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

public static void UseDataset(CatalogContext catalogContext, string virtualCatalogName)
{
    // Get the specified virtual catalog.
    VirtualCatalog virtualCatalog = (VirtualCatalog)catalogContext.GetCatalog(virtualCatalogName);
    // Get the dataset.
    CatalogVirtualCatalogRulesDataSet virtualCatalogRules = virtualCatalog.VirtualCatalogRules.DataSet;
    int count = virtualCatalogRules.VirtualCatalogRules.Count;
    // Iterate through the dataset for the specified virtual catalog and
    // access the properties of the dataset.
    for (int ruleIndex = 0; ruleIndex < count; ruleIndex++)
    {
        string catalogName = virtualCatalogRules.VirtualCatalogRules[ruleIndex].CatalogName;
        string categoryName = virtualCatalogRules.VirtualCatalogRules[ruleIndex].CategoryName;
        VirtualCatalogRuleType ruleType = (VirtualCatalogRuleType)virtualCatalogRules.VirtualCatalogRules[ruleIndex].VirtualCatalogRuleType;
    }
}

The CatalogVirtualCatalogRulesDataSetSchema Class

The CatalogVirtualCatalogRulesDataSetSchema 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