SettingsProperty.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. using System;
  29. namespace System.Configuration
  30. {
  31. public class SettingsProperty
  32. {
  33. public SettingsProperty (SettingsProperty propertyToCopy)
  34. : this (propertyToCopy.Name,
  35. propertyToCopy.PropertyType,
  36. propertyToCopy.Provider,
  37. propertyToCopy.IsReadOnly,
  38. propertyToCopy.DefaultValue,
  39. propertyToCopy.SerializeAs,
  40. new SettingsAttributeDictionary (propertyToCopy.Attributes),
  41. propertyToCopy.ThrowOnErrorDeserializing,
  42. propertyToCopy.ThrowOnErrorSerializing)
  43. {
  44. }
  45. public SettingsProperty (string name)
  46. : this (name,
  47. null,
  48. null,
  49. false,
  50. null,
  51. SettingsSerializeAs.String,
  52. new SettingsAttributeDictionary(),
  53. false,
  54. false)
  55. {
  56. }
  57. public SettingsProperty (string name,
  58. Type propertyType,
  59. SettingsProvider provider,
  60. bool isReadOnly,
  61. object defaultValue,
  62. SettingsSerializeAs serializeAs,
  63. SettingsAttributeDictionary attributes,
  64. bool throwOnErrorDeserializing,
  65. bool throwOnErrorSerializing)
  66. {
  67. this.name = name;
  68. this.propertyType = propertyType;
  69. this.provider = provider;
  70. this.isReadOnly = isReadOnly;
  71. this.defaultValue = defaultValue;
  72. this.serializeAs = serializeAs;
  73. this.attributes = attributes;
  74. this.throwOnErrorDeserializing = throwOnErrorDeserializing;
  75. this.throwOnErrorSerializing = throwOnErrorSerializing;
  76. }
  77. public virtual SettingsAttributeDictionary Attributes {
  78. get {
  79. return attributes;
  80. }
  81. }
  82. public virtual object DefaultValue {
  83. get {
  84. return defaultValue;
  85. }
  86. set {
  87. defaultValue = value;
  88. }
  89. }
  90. public virtual bool IsReadOnly {
  91. get {
  92. return isReadOnly;
  93. }
  94. set {
  95. isReadOnly = value;
  96. }
  97. }
  98. public virtual string Name {
  99. get {
  100. return name;
  101. }
  102. set {
  103. name = value;
  104. }
  105. }
  106. public virtual Type PropertyType {
  107. get {
  108. return propertyType;
  109. }
  110. set {
  111. propertyType = value;
  112. }
  113. }
  114. public virtual SettingsProvider Provider {
  115. get {
  116. return provider;
  117. }
  118. set {
  119. provider = value;
  120. }
  121. }
  122. public virtual SettingsSerializeAs SerializeAs {
  123. get {
  124. return serializeAs;
  125. }
  126. set {
  127. serializeAs = value;
  128. }
  129. }
  130. public bool ThrowOnErrorDeserializing {
  131. get {
  132. return throwOnErrorDeserializing;
  133. }
  134. set {
  135. throwOnErrorDeserializing = value;
  136. }
  137. }
  138. public bool ThrowOnErrorSerializing {
  139. get {
  140. return throwOnErrorSerializing;
  141. }
  142. set {
  143. throwOnErrorSerializing = value;
  144. }
  145. }
  146. string name;
  147. Type propertyType;
  148. SettingsProvider provider;
  149. bool isReadOnly;
  150. object defaultValue;
  151. SettingsSerializeAs serializeAs;
  152. SettingsAttributeDictionary attributes;
  153. bool throwOnErrorDeserializing;
  154. bool throwOnErrorSerializing;
  155. }
  156. }