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 ConfigurationProperty automaticSaveEnabledProp;
41 static ConfigurationProperty defaultProviderProp;
42 static ConfigurationProperty enabledProp;
43 static ConfigurationProperty inheritsProp;
44 static ConfigurationProperty propertySettingsProp;
45 static ConfigurationProperty providersProp;
47 static ConfigurationPropertyCollection properties;
49 static ProfileSection ()
51 automaticSaveEnabledProp = new ConfigurationProperty ("automaticSaveEnabled", typeof (bool), true);
52 defaultProviderProp = new ConfigurationProperty ("defaultProvider", typeof (string),
53 "AspNetSqlProfileProvider");
54 enabledProp = new ConfigurationProperty ("enabled", typeof (bool), true);
55 inheritsProp = new ConfigurationProperty ("inherits", typeof (string), "");
56 propertySettingsProp = new ConfigurationProperty ("properties", typeof (RootProfilePropertySettingsCollection));
57 providersProp = new ConfigurationProperty ("providers", typeof (ProviderSettingsCollection));
59 properties = new ConfigurationPropertyCollection ();
60 properties.Add (automaticSaveEnabledProp);
61 properties.Add (defaultProviderProp);
62 properties.Add (enabledProp);
63 properties.Add (inheritsProp);
64 properties.Add (propertySettingsProp);
65 properties.Add (providersProp);
68 [ConfigurationProperty ("automaticSaveEnabled", DefaultValue = true)]
69 public bool AutomaticSaveEnabled {
70 get { return (bool) base [automaticSaveEnabledProp]; }
71 set { base [automaticSaveEnabledProp] = 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 {
108 get { return properties; }