DefaultPortElement.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System.Configuration;
  7. using System.Net;
  8. public sealed partial class DefaultPortElement : ConfigurationElement
  9. {
  10. public DefaultPortElement()
  11. {
  12. }
  13. public DefaultPortElement(DefaultPortElement other)
  14. {
  15. this.Scheme = other.Scheme;
  16. this.Port = other.Port;
  17. }
  18. [ConfigurationProperty(ConfigurationStrings.Scheme, Options = ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired)]
  19. [StringValidator(MinLength = 1)]
  20. public string Scheme
  21. {
  22. get { return (string)base[ConfigurationStrings.Scheme]; }
  23. set
  24. {
  25. if (String.IsNullOrEmpty(value))
  26. {
  27. value = String.Empty;
  28. }
  29. base[ConfigurationStrings.Scheme] = value;
  30. }
  31. }
  32. [ConfigurationProperty(ConfigurationStrings.Port, DefaultValue = 0, Options = ConfigurationPropertyOptions.IsRequired)]
  33. [IntegerValidator(MinValue = IPEndPoint.MinPort, MaxValue = IPEndPoint.MaxPort)]
  34. public int Port
  35. {
  36. get { return (int)base[ConfigurationStrings.Port]; }
  37. set { base[ConfigurationStrings.Port] = value; }
  38. }
  39. }
  40. }