| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Configuration; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF.Configuration |
| | | 8 | | { |
| | | 9 | | public class ServiceEndpointElement : ConfigurationElement |
| | | 10 | | { |
| | | 11 | | [ConfigurationProperty(ConfigurationStrings.Address, DefaultValue = "", Options = ConfigurationPropertyOptions.I |
| | | 12 | | public Uri Address |
| | | 13 | | { |
| | 14 | 14 | | get { return (Uri)base[ConfigurationStrings.Address]; } |
| | 0 | 15 | | set { base[ConfigurationStrings.Address] = value; } |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | [ConfigurationProperty(ConfigurationStrings.BehaviorConfiguration, DefaultValue = "")] |
| | | 19 | | [StringValidator(MinLength = 0)] |
| | | 20 | | public string BehaviorConfiguration |
| | | 21 | | { |
| | 0 | 22 | | get { return (string)base[ConfigurationStrings.BehaviorConfiguration]; } |
| | | 23 | | set |
| | | 24 | | { |
| | 0 | 25 | | if (string.IsNullOrEmpty(value)) |
| | | 26 | | { |
| | 0 | 27 | | value = string.Empty; |
| | | 28 | | } |
| | 0 | 29 | | base[ConfigurationStrings.BehaviorConfiguration] = value; |
| | 0 | 30 | | } |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | [ConfigurationProperty(ConfigurationStrings.Binding, Options = ConfigurationPropertyOptions.IsKey)] |
| | | 34 | | [StringValidator(MinLength = 0)] |
| | | 35 | | public string Binding |
| | | 36 | | { |
| | 13 | 37 | | get { return (string)base[ConfigurationStrings.Binding]; } |
| | | 38 | | set |
| | | 39 | | { |
| | 0 | 40 | | if (string.IsNullOrEmpty(value)) |
| | | 41 | | { |
| | 0 | 42 | | value = string.Empty; |
| | | 43 | | } |
| | 0 | 44 | | base[ConfigurationStrings.Binding] = value; |
| | 0 | 45 | | } |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | [ConfigurationProperty(ConfigurationStrings.BindingConfiguration, DefaultValue = "", Options = ConfigurationProp |
| | | 49 | | [StringValidator(MinLength = 0)] |
| | | 50 | | public string BindingConfiguration |
| | | 51 | | { |
| | 14 | 52 | | get { return (string)base[ConfigurationStrings.BindingConfiguration]; } |
| | | 53 | | set |
| | | 54 | | { |
| | 0 | 55 | | if (string.IsNullOrEmpty(value)) |
| | | 56 | | { |
| | 0 | 57 | | value = string.Empty; |
| | | 58 | | } |
| | 0 | 59 | | base[ConfigurationStrings.BindingConfiguration] = value; |
| | 0 | 60 | | } |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | [ConfigurationProperty(ConfigurationStrings.Name, DefaultValue = "")] |
| | | 64 | | [StringValidator(MinLength = 0)] |
| | | 65 | | public string Name |
| | | 66 | | { |
| | 59 | 67 | | get { return (string)base[ConfigurationStrings.Name]; } |
| | | 68 | | set |
| | | 69 | | { |
| | 0 | 70 | | if (string.IsNullOrEmpty(value)) |
| | | 71 | | { |
| | 0 | 72 | | value = string.Empty; |
| | | 73 | | } |
| | 0 | 74 | | base[ConfigurationStrings.Name] = value; |
| | 0 | 75 | | } |
| | | 76 | | } |
| | | 77 | | |
| | | 78 | | [ConfigurationProperty(ConfigurationStrings.BindingName, DefaultValue = "", Options = ConfigurationPropertyOptio |
| | | 79 | | [StringValidator(MinLength = 0)] |
| | | 80 | | public string BindingName |
| | | 81 | | { |
| | 0 | 82 | | get { return (string)base[ConfigurationStrings.BindingName]; } |
| | | 83 | | set |
| | | 84 | | { |
| | 0 | 85 | | if (string.IsNullOrEmpty(value)) |
| | | 86 | | { |
| | 0 | 87 | | value = string.Empty; |
| | | 88 | | } |
| | 0 | 89 | | base[ConfigurationStrings.BindingName] = value; |
| | 0 | 90 | | } |
| | | 91 | | } |
| | | 92 | | |
| | | 93 | | [ConfigurationProperty(ConfigurationStrings.BindingNamespace, DefaultValue = "", Options = ConfigurationProperty |
| | | 94 | | [StringValidator(MinLength = 0)] |
| | | 95 | | public string BindingNamespace |
| | | 96 | | { |
| | 13 | 97 | | get { return (string)base[ConfigurationStrings.BindingNamespace]; } |
| | | 98 | | set |
| | | 99 | | { |
| | 0 | 100 | | if (string.IsNullOrEmpty(value)) |
| | | 101 | | { |
| | 0 | 102 | | value = string.Empty; |
| | | 103 | | } |
| | 0 | 104 | | base[ConfigurationStrings.BindingNamespace] = value; |
| | 0 | 105 | | } |
| | | 106 | | } |
| | | 107 | | |
| | | 108 | | [ConfigurationProperty(ConfigurationStrings.Contract, DefaultValue = "", Options = ConfigurationPropertyOptions. |
| | | 109 | | [StringValidator(MinLength = 0)] |
| | | 110 | | public string Contract |
| | | 111 | | { |
| | 14 | 112 | | get { return (string)base[ConfigurationStrings.Contract]; } |
| | | 113 | | set |
| | | 114 | | { |
| | 0 | 115 | | if (string.IsNullOrEmpty(value)) |
| | | 116 | | { |
| | 0 | 117 | | value = string.Empty; |
| | | 118 | | } |
| | 0 | 119 | | base[ConfigurationStrings.Contract] = value; |
| | 0 | 120 | | } |
| | | 121 | | } |
| | | 122 | | |
| | | 123 | | [ConfigurationProperty(ConfigurationStrings.ListenUri, DefaultValue = null)] |
| | | 124 | | public Uri ListenUri |
| | | 125 | | { |
| | 0 | 126 | | get { return (Uri)base[ConfigurationStrings.ListenUri]; } |
| | 0 | 127 | | set { base[ConfigurationStrings.ListenUri] = value; } |
| | | 128 | | } |
| | | 129 | | |
| | | 130 | | [ConfigurationProperty(ConfigurationStrings.IsSystemEndpoint, DefaultValue = false)] |
| | | 131 | | public bool IsSystemEndpoint |
| | | 132 | | { |
| | 0 | 133 | | get { return (bool)base[ConfigurationStrings.IsSystemEndpoint]; } |
| | 0 | 134 | | set { base[ConfigurationStrings.IsSystemEndpoint] = value; } |
| | | 135 | | } |
| | | 136 | | |
| | | 137 | | [ConfigurationProperty(ConfigurationStrings.Kind, DefaultValue = "", Options = ConfigurationPropertyOptions.IsKe |
| | | 138 | | [StringValidator(MinLength = 0)] |
| | | 139 | | public string Kind |
| | | 140 | | { |
| | 0 | 141 | | get { return (string)base[ConfigurationStrings.Kind]; } |
| | | 142 | | set |
| | | 143 | | { |
| | 0 | 144 | | if (string.IsNullOrEmpty(value)) |
| | | 145 | | { |
| | 0 | 146 | | value = string.Empty; |
| | | 147 | | } |
| | 0 | 148 | | base[ConfigurationStrings.Kind] = value; |
| | 0 | 149 | | } |
| | | 150 | | } |
| | | 151 | | |
| | | 152 | | [ConfigurationProperty(ConfigurationStrings.EndpointConfiguration, DefaultValue = "", Options = ConfigurationPro |
| | | 153 | | [StringValidator(MinLength = 0)] |
| | | 154 | | public string EndpointConfiguration |
| | | 155 | | { |
| | 0 | 156 | | get { return (string)base[ConfigurationStrings.EndpointConfiguration]; } |
| | | 157 | | set |
| | | 158 | | { |
| | 0 | 159 | | if (string.IsNullOrEmpty(value)) |
| | | 160 | | { |
| | 0 | 161 | | value = string.Empty; |
| | | 162 | | } |
| | 0 | 163 | | base[ConfigurationStrings.EndpointConfiguration] = value; |
| | 0 | 164 | | } |
| | | 165 | | } |
| | | 166 | | |
| | | 167 | | internal ServiceEndpoint CreateServiceEndpoint() |
| | | 168 | | { |
| | 0 | 169 | | var endpoint = new ServiceEndpoint() |
| | 0 | 170 | | { |
| | 0 | 171 | | Name = Name, |
| | 0 | 172 | | Address = Address, |
| | 0 | 173 | | Binding = Binding, |
| | 0 | 174 | | BindingConfiguration = BindingConfiguration, |
| | 0 | 175 | | Contract = Contract, |
| | 0 | 176 | | BindingNamespace = BindingNamespace |
| | 0 | 177 | | }; |
| | | 178 | | |
| | 0 | 179 | | return endpoint; |
| | | 180 | | } |
| | | 181 | | } |
| | | 182 | | } |