SettingsProperty.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // System.Web.UI.WebControls.SettingsProperty.cs
  3. //
  4. // Authors:
  5. // Chris Toshok ([email protected])
  6. //
  7. // (C) 2005 Novell, Inc (http://www.novell.com)
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. //
  28. #if NET_2_0
  29. using System;
  30. namespace System.Configuration
  31. {
  32. public class SettingsProperty
  33. {
  34. public SettingsProperty (SettingsProperty propertyToCopy)
  35. : this (propertyToCopy.Name,
  36. propertyToCopy.PropertyType,
  37. propertyToCopy.Provider,
  38. propertyToCopy.IsReadOnly,
  39. propertyToCopy.DefaultValue,
  40. propertyToCopy.SerializeAs,
  41. new SettingsAttributeDictionary (propertyToCopy.Attributes),
  42. propertyToCopy.ThrowOnErrorDeserializing,
  43. propertyToCopy.ThrowOnErrorSerializing)
  44. {
  45. }
  46. public SettingsProperty (string name)
  47. : this (name,
  48. null,
  49. null,
  50. false,
  51. null,
  52. SettingsSerializeAs.String,
  53. new SettingsAttributeDictionary(),
  54. false,
  55. false)
  56. {
  57. }
  58. public SettingsProperty (string name,
  59. Type propertyType,
  60. SettingsProvider provider,
  61. bool isReadOnly,
  62. object defaultValue,
  63. SettingsSerializeAs serializeAs,
  64. SettingsAttributeDictionary attributes,
  65. bool throwOnErrorDeserializing,
  66. bool throwOnErrorSerializing)
  67. {
  68. this.name = name;
  69. this.propertyType = propertyType;
  70. this.provider = provider;
  71. this.isReadOnly = isReadOnly;
  72. this.defaultValue = defaultValue;
  73. this.serializeAs = serializeAs;
  74. this.attributes = attributes;
  75. this.throwOnErrorDeserializing = throwOnErrorDeserializing;
  76. this.throwOnErrorSerializing = throwOnErrorSerializing;
  77. }
  78. public virtual SettingsAttributeDictionary Attributes {
  79. get {
  80. return attributes;
  81. }
  82. }
  83. public virtual object DefaultValue {
  84. get {
  85. return defaultValue;
  86. }
  87. set {
  88. defaultValue = value;
  89. }
  90. }
  91. public virtual bool IsReadOnly {
  92. get {
  93. return isReadOnly;
  94. }
  95. set {
  96. isReadOnly = value;
  97. }
  98. }
  99. public virtual string Name {
  100. get {
  101. return name;
  102. }
  103. set {
  104. name = value;
  105. }
  106. }
  107. public virtual Type PropertyType {
  108. get {
  109. return propertyType;
  110. }
  111. set {
  112. propertyType = value;
  113. }
  114. }
  115. public virtual SettingsProvider Provider {
  116. get {
  117. return provider;
  118. }
  119. set {
  120. provider = value;
  121. }
  122. }
  123. public virtual SettingsSerializeAs SerializeAs {
  124. get {
  125. return serializeAs;
  126. }
  127. set {
  128. serializeAs = value;
  129. }
  130. }
  131. public bool ThrowOnErrorDeserializing {
  132. get {
  133. return throwOnErrorDeserializing;
  134. }
  135. set {
  136. throwOnErrorDeserializing = value;
  137. }
  138. }
  139. public bool ThrowOnErrorSerializing {
  140. get {
  141. return throwOnErrorSerializing;
  142. }
  143. set {
  144. throwOnErrorSerializing = value;
  145. }
  146. }
  147. string name;
  148. Type propertyType;
  149. SettingsProvider provider;
  150. bool isReadOnly;
  151. object defaultValue;
  152. SettingsSerializeAs serializeAs;
  153. SettingsAttributeDictionary attributes;
  154. bool throwOnErrorDeserializing;
  155. bool throwOnErrorSerializing;
  156. }
  157. }
  158. #endif