ComContractElement.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Configuration;
  10. using System.Globalization;
  11. using System.Xml;
  12. public sealed partial class ComContractElement : ConfigurationElement
  13. {
  14. public ComContractElement() : base() { }
  15. public ComContractElement(string contractType)
  16. : this()
  17. {
  18. this.Contract = contractType;
  19. }
  20. [ConfigurationProperty(ConfigurationStrings.Contract, Options = ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired)]
  21. [StringValidator(MinLength = 1)]
  22. public string Contract
  23. {
  24. get { return (string)base[ConfigurationStrings.Contract]; }
  25. set
  26. {
  27. if (String.IsNullOrEmpty(value))
  28. {
  29. value = String.Empty;
  30. }
  31. base[ConfigurationStrings.Contract] = value;
  32. }
  33. }
  34. [ConfigurationProperty(ConfigurationStrings.ComMethodCollection, Options = ConfigurationPropertyOptions.None)]
  35. public ComMethodElementCollection ExposedMethods
  36. {
  37. get { return (ComMethodElementCollection)base[ConfigurationStrings.ComMethodCollection]; }
  38. }
  39. [ConfigurationProperty(ConfigurationStrings.ComContractName, DefaultValue = "", Options = ConfigurationPropertyOptions.None)]
  40. [StringValidator(MinLength = 0)]
  41. public string Name
  42. {
  43. get { return (string)base[ConfigurationStrings.ComContractName]; }
  44. set
  45. {
  46. if (String.IsNullOrEmpty(value))
  47. {
  48. value = String.Empty;
  49. }
  50. base[ConfigurationStrings.ComContractName] = value;
  51. }
  52. }
  53. [ConfigurationProperty(ConfigurationStrings.ComContractNamespace, DefaultValue = "", Options = ConfigurationPropertyOptions.None)]
  54. [StringValidator(MinLength = 0)]
  55. public string Namespace
  56. {
  57. get { return (string)base[ConfigurationStrings.ComContractNamespace]; }
  58. set
  59. {
  60. if (String.IsNullOrEmpty(value))
  61. {
  62. value = String.Empty;
  63. }
  64. base[ConfigurationStrings.ComContractNamespace] = value;
  65. }
  66. }
  67. [ConfigurationProperty(ConfigurationStrings.ComPersistableTypes)]
  68. public ComPersistableTypeElementCollection PersistableTypes
  69. {
  70. get { return (ComPersistableTypeElementCollection)base[ConfigurationStrings.ComPersistableTypes]; }
  71. }
  72. [ConfigurationProperty(ConfigurationStrings.ComSessionRequired, DefaultValue = true)]
  73. public bool RequiresSession
  74. {
  75. get { return (bool)base[ConfigurationStrings.ComSessionRequired]; }
  76. set
  77. {
  78. base[ConfigurationStrings.ComSessionRequired] = value;
  79. }
  80. }
  81. [ConfigurationProperty(ConfigurationStrings.ComUdtCollection)]
  82. public ComUdtElementCollection UserDefinedTypes
  83. {
  84. get { return (ComUdtElementCollection)base[ConfigurationStrings.ComUdtCollection]; }
  85. }
  86. }
  87. }