다음을 통해 공유


CatalogPropertiesDataSet.CatalogProperty Class

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

Allows access to the CatalogPropertiesDataSet..::.CatalogPropertiesDataTable table.

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

Syntax

'Declaration
Public Class CatalogProperty _
    Inherits DataRow
'Usage
Dim instance As CatalogPropertiesDataSet.CatalogProperty
public class CatalogProperty : DataRow
public ref class CatalogProperty : public DataRow
public class CatalogProperty extends DataRow

Remarks

Gets and sets the values in the CatalogPropertiesDataSet..::.CatalogPropertiesDataTable table.

Examples

// Get properties in the catalog system meeting criteria in a search clause
internal CatalogPropertiesDataSet GetProperties(string searchClause)
{
  // Get the properties in the catalog system. The searchClause can be a valid SQL statement 
  // like [PropertyName] LIKE N'%Color%' AND [DisplayOnSite] = 1. The column names  should be 
  // surrounded by [] and the string values should be preceded with N.
  CatalogPropertiesDataSet catalogProperties = catalogContext.GetProperties(searchClause);
  foreach (CatalogPropertiesDataSet.CatalogProperty property in catalogProperties.CatalogProperties)
  {
    // Access the property attributes
    bool displayInProductsList = property.DisplayInProductsList;
    string languageInSensitiveDisplayName = property.DisplayName;
    string languageSensitiveDisplayName;
    string language = "en-US";
    // The language specific display names are stored in the DisplayName_<language> column.
    string languageSensitiveDisplayNameColumn = string.Format("{0}_{1}", CatalogPropertiesDataSetSchema.DisplayName, language);
    if (property.Table.Columns.Contains(languageSensitiveDisplayNameColumn))
    {
      // Before accessing the value of the column check that the 
      // value is not null.
      if ( !property.IsNull(languageSensitiveDisplayNameColumn))
      {
        languageSensitiveDisplayName = (string)property[languageSensitiveDisplayNameColumn];
      }
    }
    // Access all other attributes using the strongly typed properties on the property object
    // User defined properties can be accessed using the indexer
    // Before accessing a property use the IsNull method ro check if the 
    // value is null or not.For strongly typed properties use the IsStronglyTypedPropertyNameNull() method to 
    // determine if the value is null or not. eg property.IsMinimumStringLengthNull()
    /* 
     * For eg if HelpId is a user defined property then it can be accessed as
     *  string value = null;
     *  if ( !property.IsNull("HelpId"))
     *    value = property["HelpId"].ToString();
    */
  }
  return catalogProperties;
} 

Inheritance Hierarchy

System..::.Object
  System.Data..::.DataRow
    Microsoft.CommerceServer.Catalog..::.CatalogPropertiesDataSet..::.CatalogProperty

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

CatalogPropertiesDataSet..::.CatalogProperty Members

Microsoft.CommerceServer.Catalog Namespace