Bagikan melalui


CatalogDefinitionsDataSet

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

The CatalogDefinitionsDataSet class contains information about the category and product definitions in the Catalog System. You can access the DataRowCollection of the dataset’s data table by using the CatalogDefinitions property. You can access each row in the collection by using the properties of the CatalogDefinitionsDataSet..::.CatalogDefinition class.

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

Property

Description

DefinitionId

This property is internal to the Catalog System and should not be used.

DefinitionName

Gets a string that contains the name of the catalog definition; maximum length is 128 characters.

DefinitionType

Gets an integer value that specifies the type of the definition. This property is one of the values of the CatalogDefinitionType enumeration. The possible values are as follows:

  • 0 - ProductDefinition

  • 1 - CategoryDefinition

Description

Gets and sets a string that contains a description of the definition.

Constraints

The CatalogDefinitionsDataSet class defines a unique constraint on the DefinitionName column.

Using the CatalogDefinitionsDataSet Class

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

public static void UseDataset(CatalogContext context, string defName)
{
    // Get an existing definition.
    CatalogDefinition definition = context.GetDefinition(defName);
    // Get the attributes for the first item in the dataset.
    CatalogDefinitionsDataSet catalogDefinitionInfo = definition.Information;
    CatalogDefinitionsDataSet.CatalogDefinition definitionAttributes = catalogDefinitionInfo.CatalogDefinitions[0];
    string definitionName = definitionAttributes.DefinitionName;
    CatalogDefinitionType definitionType = (CatalogDefinitionType)definitionAttributes.DefinitionType;

    // Iterate through the dataset and access each catalog definition.
    
    foreach(CatalogDefinitionsDataSet.CatalogDefinition catalogDefinition in context.GetDefinitions().CatalogDefinitions)
    {
        definitionName = catalogDefinition.DefinitionName;
        definitionType = (CatalogDefinitionType)catalogDefinition.DefinitionType;
        // Write the items to the console.
        Console.WriteLine("Definition {0} is a {1}", definitionName, definitionType);
    }
}

The CatalogDefinitionsDataSetSchema Class

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