| | | 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 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Configuration |
| | | 9 | | { |
| | | 10 | | public abstract class StandardBindingElement : ServiceModelConfigurationElement, IDefaultCommunicationTimeouts, ISta |
| | | 11 | | { |
| | | 12 | | protected StandardBindingElement() |
| | 0 | 13 | | : this(null) |
| | | 14 | | { |
| | 0 | 15 | | } |
| | | 16 | | |
| | 24 | 17 | | protected StandardBindingElement(string name) |
| | | 18 | | { |
| | 24 | 19 | | if (!string.IsNullOrEmpty(name)) |
| | | 20 | | { |
| | 0 | 21 | | Name = name; |
| | | 22 | | } |
| | 24 | 23 | | } |
| | | 24 | | |
| | | 25 | | [ConfigurationProperty(ConfigurationStrings.Name, Options = ConfigurationPropertyOptions.IsKey)] |
| | | 26 | | [StringValidator(MinLength = 0)] |
| | | 27 | | public string Name |
| | | 28 | | { |
| | 97 | 29 | | get { return (string)base[ConfigurationStrings.Name]; } |
| | | 30 | | set |
| | | 31 | | { |
| | 0 | 32 | | if (string.IsNullOrEmpty(value)) |
| | | 33 | | { |
| | 0 | 34 | | value = string.Empty; |
| | | 35 | | } |
| | 0 | 36 | | base[ConfigurationStrings.Name] = value; |
| | 0 | 37 | | } |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | [ConfigurationProperty(ConfigurationStrings.CloseTimeout, DefaultValue = ServiceDefaults.CloseTimeoutString)] |
| | | 41 | | public TimeSpan CloseTimeout |
| | | 42 | | { |
| | 19 | 43 | | get { return (TimeSpan)base[ConfigurationStrings.CloseTimeout]; } |
| | 0 | 44 | | set { base[ConfigurationStrings.CloseTimeout] = value; } |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | [ConfigurationProperty(ConfigurationStrings.OpenTimeout, DefaultValue = ServiceDefaults.OpenTimeoutString)] |
| | | 48 | | public TimeSpan OpenTimeout |
| | | 49 | | { |
| | 19 | 50 | | get { return (TimeSpan)base[ConfigurationStrings.OpenTimeout]; } |
| | 0 | 51 | | set { base[ConfigurationStrings.OpenTimeout] = value; } |
| | | 52 | | } |
| | | 53 | | |
| | | 54 | | [ConfigurationProperty(ConfigurationStrings.ReceiveTimeout, DefaultValue = ServiceDefaults.ReceiveTimeoutString) |
| | | 55 | | public TimeSpan ReceiveTimeout |
| | | 56 | | { |
| | 24 | 57 | | get { return (TimeSpan)base[ConfigurationStrings.ReceiveTimeout]; } |
| | 0 | 58 | | set { base[ConfigurationStrings.ReceiveTimeout] = value; } |
| | | 59 | | } |
| | | 60 | | |
| | | 61 | | [ConfigurationProperty(ConfigurationStrings.SendTimeout, DefaultValue = ServiceDefaults.SendTimeoutString)] |
| | | 62 | | public TimeSpan SendTimeout |
| | | 63 | | { |
| | 19 | 64 | | get { return (TimeSpan)base[ConfigurationStrings.SendTimeout]; } |
| | 0 | 65 | | set { base[ConfigurationStrings.SendTimeout] = value; } |
| | | 66 | | } |
| | | 67 | | |
| | | 68 | | public abstract Binding CreateBinding(); |
| | | 69 | | |
| | | 70 | | } |
| | | 71 | | } |