2 // System.Web.Configuration.ProfileSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
34 using System.Configuration;
36 namespace System.Web.Configuration
38 public sealed class ProfileSection: ConfigurationSection
40 static ConfigurationPropertyCollection properties;
41 static ConfigurationProperty autoSaveEnabledProp;
42 static ConfigurationProperty defaultProviderProp;
43 static ConfigurationProperty enabledProp;
44 static ConfigurationProperty inheritsProp;
45 static ConfigurationProperty propertySettingsProp;
46 static ConfigurationProperty providersProp;
48 static ProfileSection ()
50 autoSaveEnabledProp = new ConfigurationProperty ("automaticSaveEnabled", typeof (bool), true);
51 defaultProviderProp = new ConfigurationProperty ("defaultProviderProp", typeof (string), "AspNetSqlProfileProvider");
52 inheritsProp = new ConfigurationProperty ("inheritsProps", typeof (string), "");
53 propertySettingsProp = new ConfigurationProperty ("propertiesProp", typeof (RootProfilePropertySettingsCollection), null);
54 providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection), null);
56 properties = new ConfigurationPropertyCollection ();
57 properties.Add (autoSaveEnabledProp);
58 properties.Add (defaultProviderProp);
59 properties.Add (inheritsProp);
60 properties.Add (propertySettingsProp);
61 properties.Add (providersProp);
64 public ProfileSection ()
68 [ConfigurationProperty ("automaticSaveEnabled", DefaultValue = true)]
69 public bool AutomaticSaveEnabled {
70 get { return (bool) base [autoSaveEnabledProp]; }
71 set { base [autoSaveEnabledProp] = value; }
74 [ConfigurationProperty ("defaultProvider", DefaultValue = "AspNetSqlProfileProvider")]
75 [StringValidator (MinLength = 1)]
76 public string DefaultProvider {
77 get { return (string) base [defaultProviderProp]; }
78 set { base [defaultProviderProp] = value; }
81 [ConfigurationProperty ("enabled", DefaultValue = true)]
83 get { return (bool) base [enabledProp]; }
84 set { base [enabledProp] = value; }
87 [ConfigurationProperty ("inherits", DefaultValue = "")]
88 public string Inherits {
89 get { return (string) base [inheritsProp]; }
90 set { base [inheritsProp] = value; }
93 [ConfigurationProperty ("properties")]
94 public RootProfilePropertySettingsCollection PropertySettings {
96 return (RootProfilePropertySettingsCollection) base[propertySettingsProp];
100 [ConfigurationProperty ("providers")]
101 public ProviderSettingsCollection Providers {
103 return (ProviderSettingsCollection) base[providersProp];
107 protected override ConfigurationPropertyCollection Properties {