| | | 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 EndpointAddressElementBase : ServiceModelConfigurationElement |
| | | 10 | | { |
| | 2 | 11 | | protected EndpointAddressElementBase() |
| | | 12 | | { |
| | 2 | 13 | | } |
| | | 14 | | |
| | | 15 | | [ConfigurationProperty(ConfigurationStrings.Address, DefaultValue = null, Options = ConfigurationPropertyOptions |
| | | 16 | | public Uri Address |
| | | 17 | | { |
| | 0 | 18 | | get { return (Uri)base[ConfigurationStrings.Address]; } |
| | 0 | 19 | | set { base[ConfigurationStrings.Address] = value; } |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | [ConfigurationProperty(ConfigurationStrings.Headers)] |
| | | 23 | | public AddressHeaderCollectionElement Headers |
| | | 24 | | { |
| | 0 | 25 | | get { return (AddressHeaderCollectionElement)base[ConfigurationStrings.Headers]; } |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | //TODO: Add Identity Support |
| | | 29 | | //[ConfigurationProperty(ConfigurationStrings.Identity)] |
| | | 30 | | //public IdentityElement Identity |
| | | 31 | | //{ |
| | | 32 | | // get { return (IdentityElement)base[ConfigurationStrings.Identity]; } |
| | | 33 | | //} |
| | | 34 | | |
| | | 35 | | |
| | | 36 | | internal protected void Copy(EndpointAddressElementBase source) |
| | | 37 | | { |
| | 0 | 38 | | if (IsReadOnly()) |
| | | 39 | | { |
| | 0 | 40 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.Format(SR. |
| | | 41 | | } |
| | 0 | 42 | | if (null == source) |
| | | 43 | | { |
| | 0 | 44 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(source)); |
| | | 45 | | } |
| | | 46 | | |
| | 0 | 47 | | Address = source.Address; |
| | 0 | 48 | | Headers.Headers = source.Headers.Headers; |
| | | 49 | | //TODO: Add Identity Support |
| | | 50 | | //PropertyInformationCollection properties = source.ElementInformation.Properties; |
| | | 51 | | //if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default) |
| | | 52 | | //{ |
| | | 53 | | // this.Identity.Copy(source.Identity); |
| | | 54 | | //} |
| | 0 | 55 | | } |
| | | 56 | | |
| | | 57 | | public void InitializeFrom(EndpointAddress endpointAddress) |
| | | 58 | | { |
| | 0 | 59 | | if (null == endpointAddress) |
| | | 60 | | { |
| | 0 | 61 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointAddress)); |
| | | 62 | | } |
| | | 63 | | |
| | 0 | 64 | | SetPropertyValueIfNotDefaultValue(ConfigurationStrings.Address, endpointAddress.Uri); |
| | 0 | 65 | | Headers.InitializeFrom(endpointAddress.Headers); |
| | | 66 | | //TODO: Add Identity Support |
| | | 67 | | //if (null != endpointAddress.Identity) |
| | | 68 | | //{ |
| | | 69 | | // this.Identity.InitializeFrom(endpointAddress.Identity); |
| | | 70 | | //} |
| | 0 | 71 | | } |
| | | 72 | | } |
| | | 73 | | } |