Udostępnij za pośrednictwem


CatalogProperty Class

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

Provides properties and methods to manage catalog properties.

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

Syntax

'Declaration
<StrongNameIdentityPermissionAttribute(SecurityAction.InheritanceDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")> _
Public MustInherit Class CatalogProperty _
    Inherits CatalogObject
'Usage
Dim instance As CatalogProperty
[StrongNameIdentityPermissionAttribute(SecurityAction.InheritanceDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
public abstract class CatalogProperty : CatalogObject
[StrongNameIdentityPermissionAttribute(SecurityAction::InheritanceDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
public ref class CatalogProperty abstract : public CatalogObject
public abstract class CatalogProperty extends CatalogObject

Remarks

An abstract class. Manage the catalog properties through this class.

Examples

try
{
  // Set the required attributes on the property 
  property.Information.CatalogProperties[0].ExportToDW = true;
  property.Information.CatalogProperties[0].DisplayName = "Test DisplayName";
  property.Information.CatalogProperties[0].DisplayInProductsList = true;
  // To set a  value of an attribute to null use the SetXXXNull() method
  property.Information.CatalogProperties[0].SetCurrencyNull();
  // To set default values use the corresponding XXXDefaultValue method
  // If the property is not multilingual 
  if (property.DataType == CatalogDataType.String && !property.Information.CatalogProperties[0].LanguageSensitive)
  {
  property.Information.CatalogProperties[0].DefaultStringValue = "default";
  }
  else if (property.DataType == CatalogDataType.String && property.Information.CatalogProperties[0].LanguageSensitive)
  {
    string language = "en-US";
    // The language sensitive default value is stored in the u_defaultvalue_<language> column
    string defaultValueColumn = string.Format("{0}_{1}", CatalogPropertiesDataSetSchema.DefaultStringValue, language);
    // Check that the default value column exists before setting th
    if (property.Information.CatalogProperties.Columns.Contains(defaultValueColumn))
    {
      property.Information.CatalogProperties[0][defaultValueColumn] = "en-US default value";
    }
  }
  // To set values for properties added as entity extensions 
  /* Assuming that HelpId is added as an entity extension
   * property["HelpId"] = value;
  */

  // Finally call Save to save the changes to the catalog system
  property.Save();

}
catch (OptimisticLockException ex)
{
  // The property was modified by another user
  Console.WriteLine(ex.Message);
}

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Catalog..::.CatalogObjectBase
    Microsoft.CommerceServer.Catalog..::.CatalogObject
      Microsoft.CommerceServer.Catalog..::.CatalogProperty
        Microsoft.CommerceServer.Catalog..::.CatalogEnumerationProperty
        Microsoft.CommerceServer.Catalog..::.RegularCatalogProperty

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

CatalogProperty Members

Microsoft.CommerceServer.Catalog Namespace