| | | 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.Configuration; |
| | | 5 | | using CoreWCF.Channels; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF.Configuration |
| | | 8 | | { |
| | | 9 | | public abstract class TransportElement : BindingElementExtensionElement |
| | | 10 | | { |
| | | 11 | | public override void ApplyConfiguration(BindingElement bindingElement) |
| | | 12 | | { |
| | 6 | 13 | | base.ApplyConfiguration(bindingElement); |
| | 6 | 14 | | TransportBindingElement binding = (TransportBindingElement)bindingElement; |
| | 6 | 15 | | binding.ManualAddressing = ManualAddressing; |
| | 6 | 16 | | binding.MaxBufferPoolSize = MaxBufferPoolSize; |
| | 6 | 17 | | binding.MaxReceivedMessageSize = MaxReceivedMessageSize; |
| | 6 | 18 | | } |
| | | 19 | | |
| | | 20 | | public override void CopyFrom(ServiceModelExtensionElement from) |
| | | 21 | | { |
| | 0 | 22 | | base.CopyFrom(from); |
| | | 23 | | |
| | 0 | 24 | | TransportElement source = (TransportElement)from; |
| | 0 | 25 | | ManualAddressing = source.ManualAddressing; |
| | 0 | 26 | | MaxBufferPoolSize = source.MaxBufferPoolSize; |
| | 0 | 27 | | MaxReceivedMessageSize = source.MaxReceivedMessageSize; |
| | 0 | 28 | | } |
| | | 29 | | |
| | | 30 | | protected internal override BindingElement CreateBindingElement() |
| | | 31 | | { |
| | 6 | 32 | | TransportBindingElement binding = CreateDefaultBindingElement(); |
| | 6 | 33 | | ApplyConfiguration(binding); |
| | 6 | 34 | | return binding; |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | protected abstract TransportBindingElement CreateDefaultBindingElement(); |
| | | 38 | | |
| | | 39 | | protected internal override void InitializeFrom(BindingElement bindingElement) |
| | | 40 | | { |
| | 0 | 41 | | base.InitializeFrom(bindingElement); |
| | 0 | 42 | | TransportBindingElement binding = (TransportBindingElement)bindingElement; |
| | 0 | 43 | | SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ManualAddressing, binding.ManualAddressing); |
| | 0 | 44 | | SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxBufferPoolSize, binding.MaxBufferPoolSize); |
| | 0 | 45 | | SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxReceivedMessageSize, binding.MaxReceivedMessageSiz |
| | 0 | 46 | | } |
| | | 47 | | |
| | | 48 | | [ConfigurationProperty(ConfigurationStrings.ManualAddressing, DefaultValue = false)] |
| | | 49 | | public bool ManualAddressing |
| | | 50 | | { |
| | 6 | 51 | | get { return (bool)base[ConfigurationStrings.ManualAddressing]; } |
| | 0 | 52 | | set { base[ConfigurationStrings.ManualAddressing] = value; } |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | [ConfigurationProperty(ConfigurationStrings.MaxBufferPoolSize, DefaultValue = TransportDefaults.MaxBufferPoolSiz |
| | | 56 | | [LongValidator(MinValue = 1)] |
| | | 57 | | public long MaxBufferPoolSize |
| | | 58 | | { |
| | 6 | 59 | | get { return (long)base[ConfigurationStrings.MaxBufferPoolSize]; } |
| | 0 | 60 | | set { base[ConfigurationStrings.MaxBufferPoolSize] = value; } |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | [ConfigurationProperty(ConfigurationStrings.MaxReceivedMessageSize, DefaultValue = TransportDefaults.MaxReceived |
| | | 64 | | [LongValidator(MinValue = 1)] |
| | | 65 | | public long MaxReceivedMessageSize |
| | | 66 | | { |
| | 6 | 67 | | get { return (long)base[ConfigurationStrings.MaxReceivedMessageSize]; } |
| | 0 | 68 | | set { base[ConfigurationStrings.MaxReceivedMessageSize] = value; } |
| | | 69 | | } |
| | | 70 | | } |
| | | 71 | | } |