Backport of some changes from svn trunk - performance improvement and a fix for bug...
[mono-project.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ProfilePropertySettings.cs
blobaa001b47f40b0c5607778e3d9891385eea6bdbd6
1 //
2 // System.Web.Configuration.ProfilePropertySettingsCollection
3 //
4 // Authors:
5 // Chris Toshok (toshok@ximian.com)
6 //
7 // (C) 2005 Novell, Inc (http://www.novell.com)
8 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #if NET_2_0
33 using System;
34 using System.ComponentModel;
35 using System.Configuration;
37 namespace System.Web.Configuration
39 public sealed class ProfilePropertySettings : ConfigurationElement
41 static ConfigurationProperty allowAnonymousProp;
42 static ConfigurationProperty customProviderDataProp;
43 static ConfigurationProperty defaultValueProp;
44 static ConfigurationProperty nameProp;
45 static ConfigurationProperty providerProp;
46 static ConfigurationProperty readOnlyProp;
47 static ConfigurationProperty serializeAsProp;
48 static ConfigurationProperty typeProp;
50 static ConfigurationPropertyCollection properties;
52 static ProfilePropertySettings ()
54 allowAnonymousProp = new ConfigurationProperty ("allowAnonymous", typeof (bool), false);
55 customProviderDataProp = new ConfigurationProperty ("customProviderData", typeof (string), "");
56 defaultValueProp = new ConfigurationProperty ("defaultValue", typeof (string), "");
57 nameProp = new ConfigurationProperty ("name", typeof (string), null,
58 TypeDescriptor.GetConverter (typeof (string)),
59 new ProfilePropertyNameValidator (),
60 ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
61 providerProp = new ConfigurationProperty ("provider", typeof (string), "");
62 readOnlyProp = new ConfigurationProperty ("readOnly", typeof (bool), false);
63 serializeAsProp = new ConfigurationProperty ("serializeAs", typeof (SerializationMode), SerializationMode.ProviderSpecific,
64 new GenericEnumConverter (typeof (SerializationMode)),
65 PropertyHelper.DefaultValidator,
66 ConfigurationPropertyOptions.None);
67 typeProp = new ConfigurationProperty ("type", typeof (string), "string");
69 properties = new ConfigurationPropertyCollection ();
70 properties.Add (allowAnonymousProp);
71 properties.Add (customProviderDataProp);
72 properties.Add (defaultValueProp);
73 properties.Add (nameProp);
74 properties.Add (providerProp);
75 properties.Add (readOnlyProp);
76 properties.Add (serializeAsProp);
77 properties.Add (typeProp);
80 internal ProfilePropertySettings ()
84 public ProfilePropertySettings (string name)
86 this.Name = name;
89 public ProfilePropertySettings (string name, bool readOnly, SerializationMode serializeAs,
90 string providerName, string defaultValue, string profileType,
91 bool allowAnonymous, string customProviderData)
93 this.Name = name;
94 this.ReadOnly = readOnly;
95 this.SerializeAs = serializeAs;
96 this.Provider = providerName;
97 this.DefaultValue = defaultValue;
98 this.Type = profileType;
99 this.AllowAnonymous = allowAnonymous;
100 this.CustomProviderData = customProviderData;
103 [ConfigurationProperty ("allowAnonymous", DefaultValue = false)]
104 public bool AllowAnonymous {
105 get { return (bool) base[allowAnonymousProp]; }
106 set { base [allowAnonymousProp] = value; }
109 [ConfigurationProperty ("customProviderData", DefaultValue = "")]
110 public string CustomProviderData {
111 get { return (string) base[customProviderDataProp]; }
112 set { base[customProviderDataProp] = value; }
115 [ConfigurationProperty ("defaultValue", DefaultValue = "")]
116 public string DefaultValue {
117 get { return (string) base[defaultValueProp]; }
118 set { base[defaultValueProp] = value; }
121 [ConfigurationProperty ("name", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
122 public string Name {
123 get { return (string) base[nameProp]; }
124 set { base[nameProp] = value; }
127 [ConfigurationProperty ("provider", DefaultValue = "")]
128 public string Provider {
129 get { return (string) base[providerProp]; }
130 set { base[providerProp] = value; }
133 [ConfigurationProperty ("readOnly", DefaultValue = false)]
134 public bool ReadOnly {
135 get { return (bool) base[readOnlyProp]; }
136 set { base[readOnlyProp] = value; }
139 [ConfigurationProperty ("serializeAs", DefaultValue = "ProviderSpecific")]
140 public SerializationMode SerializeAs {
141 get { return (SerializationMode) base[serializeAsProp]; }
142 set { base[serializeAsProp] = value; }
145 [ConfigurationProperty ("type", DefaultValue = "string")]
146 public string Type {
147 get { return (string) base[typeProp]; }
148 set { base[typeProp] = value; }
151 protected override ConfigurationPropertyCollection Properties {
152 get {
153 return properties;
161 #endif