1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
//------------------------------------------------------------------------------
// <copyright file="ProfilePropertySettings.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Xml;
using System.Configuration;
using System.Collections.Specialized;
using System.Collections;
using System.IO;
using System.Text;
using System.Web.Util;
using System.Security.Permissions;
// ProfilePropertySettingsCollection
public sealed class ProfilePropertySettings : ConfigurationElement {
private static ConfigurationPropertyCollection _properties;
private static readonly ConfigurationProperty _propName =
new ConfigurationProperty("name",
typeof(string),
null,
null,
ProfilePropertyNameValidator.SingletonInstance,
ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
private static readonly ConfigurationProperty _propReadOnly =
new ConfigurationProperty("readOnly",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propSerializeAs =
new ConfigurationProperty("serializeAs",
typeof(SerializationMode),
SerializationMode.ProviderSpecific,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propProviderName =
new ConfigurationProperty("provider",
typeof(string),
"",
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propDefaultValue =
new ConfigurationProperty("defaultValue",
typeof(string),
"",
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propType =
new ConfigurationProperty("type",
typeof(string),
"string",
ConfigurationPropertyOptions.IsTypeStringTransformationRequired);
private static readonly ConfigurationProperty _propAllowAnonymous =
new ConfigurationProperty("allowAnonymous",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propCustomProviderData =
new ConfigurationProperty("customProviderData",
typeof(string),
"",
ConfigurationPropertyOptions.None);
static ProfilePropertySettings() {
// Property initialization
_properties = new ConfigurationPropertyCollection();
_properties.Add(_propName);
_properties.Add(_propReadOnly);
_properties.Add(_propSerializeAs);
_properties.Add(_propProviderName);
_properties.Add(_propDefaultValue);
_properties.Add(_propType);
_properties.Add(_propAllowAnonymous);
_properties.Add(_propCustomProviderData);
}
private Type _type;
private SettingsProvider _providerInternal;
internal ProfilePropertySettings() {
}
public ProfilePropertySettings(string name) {
Name = name;
}
public ProfilePropertySettings(string name, bool readOnly, SerializationMode serializeAs,
string providerName, string defaultValue, string profileType,
bool allowAnonymous, string customProviderData) {
Name = name;
ReadOnly = readOnly;
SerializeAs = serializeAs;
Provider = providerName;
DefaultValue = defaultValue;
Type = profileType;
AllowAnonymous = allowAnonymous;
CustomProviderData = customProviderData;
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
public string Name {
get {
return (string)base[_propName];
}
set {
base[_propName] = value;
}
}
[ConfigurationProperty("readOnly", DefaultValue = false)]
public bool ReadOnly {
get {
return (bool)base[_propReadOnly];
}
set {
base[_propReadOnly] = value;
}
}
[ConfigurationProperty("serializeAs", DefaultValue = SerializationMode.ProviderSpecific)]
public SerializationMode SerializeAs {
get {
return (SerializationMode)base[_propSerializeAs];
}
set {
base[_propSerializeAs] = value;
}
}
[ConfigurationProperty("provider", DefaultValue = "")]
public string Provider {
get {
return (string)base[_propProviderName];
}
set {
base[_propProviderName] = value;
}
}
internal SettingsProvider ProviderInternal {
get {
return _providerInternal;
}
set {
_providerInternal = value;
}
}
[ConfigurationProperty("defaultValue", DefaultValue = "")]
public string DefaultValue {
get {
return (string)base[_propDefaultValue];
}
set {
base[_propDefaultValue] = value;
}
}
[ConfigurationProperty("type", DefaultValue = "string")]
public string Type {
get {
return (string)base[_propType];
}
set {
base[_propType] = value;
}
}
internal Type TypeInternal {
get {
return _type;
}
set {
_type = value;
}
}
[ConfigurationProperty("allowAnonymous", DefaultValue = false)]
public bool AllowAnonymous {
get {
return (bool)base[_propAllowAnonymous];
}
set {
base[_propAllowAnonymous] = value;
}
}
[ConfigurationProperty("customProviderData", DefaultValue = "")]
public string CustomProviderData {
get {
return (string)base[_propCustomProviderData];
}
set {
base[_propCustomProviderData] = value;
}
}
} // class ProfilePropertySettings
}
|