Application Settings Attributes

 

The Application Settings architecture provides many attributes that can be applied either to the applications settings wrapper class or its individual properties. These attributes are examined at run time by the application settings infrastructure, often specifically the settings provider, in order to tailor its functioning to the stated needs of the custom wrapper.

The following table lists the attributes that can be applied to the application settings wrapper class, this class's individual properties, or both. By definition, only a single scope attribute—UserScopedSettingAttribute or ApplicationScopedSettingAttribute—must be applied to each and every settings property.

System_CAPS_ICON_note.jpg Note

A custom settings provider, derived from the SettingsProvider class, is only required to recognize the following three attributes: ApplicationScopedSettingAttribute, UserScopedSettingAttribute, and DefaultSettingValueAttribute.

AttributeTargetDescription
SettingsProviderAttributeBothSpecifies the short name of the settings provider to use for persistence.

If this attribute is not supplied, the default provider, LocalFileSettingsProvider, is assumed.
UserScopedSettingAttributeBothDefines a property as a user-scoped application setting.
ApplicationScopedSettingAttributeBothDefines a property as an application-scoped application setting.
DefaultSettingValueAttributePropertySpecifies a string that can be deserialized by the provider into the hard-coded default value for this property.

The LocalFileSettingsProvider does not require this attribute, and will override any value provided by this attribute if there is a value already persisted.
SettingsDescriptionAttributePropertyProvides the descriptive test for an individual setting, used primarily by run-time and design-time tools.
SettingsGroupNameAttributeClassProvides an explicit name for a settings group. If this attribute is missing, ApplicationSettingsBase uses the wrapper class name.
SettingsGroupDescriptionAttributeClassProvides the descriptive test for a settings group, used primarily by run-time and design-time tools.
SettingsManageabilityAttributeBothSpecifies zero or more manageability services that should be provided to the settings group or property. The available services are described by the SettingsManageability enumeration.
SpecialSettingAttributePropertyIndicates that a setting belongs to a special, predefined category, such as a connection string, that suggests special processing by the settings provider. The predefined categories for this attribute are defined by the SpecialSetting enumeration.
SettingsSerializeAsAttributeBothSpecifies a preferred serialization mechanism for a settings group or property. The available serialization mechanisms are defined by the SettingsSerializeAs enumeration.
NoSettingsVersionUpgradeAttributePropertySpecifies that a settings provider should disable all application upgrade functionality for the marked property.

Class indicates that the attribute can be applied only to an application settings wrapper class. Property indicates that the attribute can be applied only settings properties. Both indicates that the attribute can be applied at either level.

ApplicationSettingsBase
SettingsProvider
Application Settings Architecture
How to: Create Application Settings

Show: