New test.
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / ProfileSection.cs
1 //
2 // System.Web.Configuration.ProfileSection
3 //
4 // Authors:
5 //      Chris Toshok (toshok@ximian.com)
6 //
7 // (C) 2005 Novell, Inc (http://www.novell.com)
8 //
9
10 //
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.
29 //
30
31 #if NET_2_0
32
33 using System;
34 using System.Configuration;
35
36 namespace System.Web.Configuration
37 {
38         public sealed class ProfileSection: ConfigurationSection
39         {
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;
47
48                 static ProfileSection ()
49                 {
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);
55
56                         properties = new ConfigurationPropertyCollection ();
57                         properties.Add (autoSaveEnabledProp);
58                         properties.Add (defaultProviderProp);
59                         properties.Add (inheritsProp);
60                         properties.Add (propertySettingsProp);
61                         properties.Add (providersProp);
62                 }
63
64                 public ProfileSection ()
65                 {
66                 }
67
68                 [ConfigurationProperty ("automaticSaveEnabled", DefaultValue = true)]
69                 public bool AutomaticSaveEnabled {
70                         get { return (bool) base [autoSaveEnabledProp]; }
71                         set { base [autoSaveEnabledProp] = value; }
72                 }
73
74                 [ConfigurationProperty ("defaultProvider", DefaultValue = "AspNetSqlProfileProvider")]
75                 [StringValidator (MinLength = 1)]
76                 public string DefaultProvider {
77                         get { return (string) base [defaultProviderProp]; }
78                         set { base [defaultProviderProp] = value; }
79                 }
80
81                 [ConfigurationProperty ("enabled", DefaultValue = true)]
82                 public bool Enabled {
83                         get { return (bool) base [enabledProp]; }
84                         set { base [enabledProp] = value; }
85                 }
86
87                 [ConfigurationProperty ("inherits", DefaultValue = "")]
88                 public string Inherits {
89                         get { return (string) base [inheritsProp]; }
90                         set { base [inheritsProp] = value; }
91                 }
92
93                 [ConfigurationProperty ("properties")]
94                 public RootProfilePropertySettingsCollection PropertySettings {
95                         get {
96                                 return (RootProfilePropertySettingsCollection) base[propertySettingsProp];
97                         }
98                 }
99
100                 [ConfigurationProperty ("providers")]
101                 public ProviderSettingsCollection Providers {
102                         get {
103                                 return (ProviderSettingsCollection) base[providersProp];
104                         }
105                 }
106
107                 protected override ConfigurationPropertyCollection Properties {
108                         get {
109                                 return properties;
110                         }
111                 }
112
113         }
114 }
115
116 #endif