Kopīgot, izmantojot


CatalogEnumerationPropertyValuesDataSet

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

The CatalogEnumerationPropertyValuesDataSet class contains the enumeration values for a catalog property of the enumeration data type. You can access the DataRowCollection of the dataset’s data table by using the EnumerationPropertyValues property. You can access each row in the collection by using the properties of the CatalogEnumerationPropertyValuesDataSet..::.EnumerationPropertyValue class.

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

Property

Description

Language

Gets or sets a string that specifies the language to which the property value applies; maximum length is 10 characters. If a property is not multilingual, this value is an empty string.

PropertyName

Gets or sets a string that specifies the name of the property in the Catalog System; maximum length is 128 characters.

PropertyValue

Gets or sets a string that specifies one of the enumeration values that has been defined for the property; maximum length is 128 characters.

Rank

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

Constraints

The CatalogEnumerationPropertyValuesDataSet class defines a unique constraint on the PropertyValue, PropertyName, and Language columns.

Using the CatalogEnumerationValuesDataSet Class

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

public static void UseDataset(CatalogContext context)
{
    // Create a new enumeration property named "Colors". 
    CatalogProperty catalogProperty = catalogContext.CreateProperty("Colors", CatalogDataType.Enumeration, 0);
    catalogProperty.Information.CatalogProperties[0].LanguageSensitive = true;
    // Add new property values to the enumeration
    // and save the enumeration to the Catalog System.
    catalogProperty.AddEnumerationPropertyValue("Red", "en-US");
    catalogProperty.AddEnumerationPropertyValue("Green", "en-US");
    catalogProperty.Save();
    // Iterate through the data set and access the property values.
    // Write the values to the console.
    foreach (CatalogEnumerationPropertyValuesDataSet.EnumerationPropertyValue enumeratedValue in catalogProperty.EnumerationValues.EnumerationPropertyValues)
    {
        string propertyName = enumeratedValue.PropertyName;
        string propertyValue = enumeratedValue.PropertyValue;
        string language = enumeratedValue.Language;
        Console.WriteLine("Enumerated property {0} has value {1}", propertyName, propertyValue);
    }
}

The CatalogEnumerationValuesDataSetSchema Class

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