| | | 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 abstract class NamedServiceModelExtensionCollectionElement<TServiceModelExtensionElement> : ServiceModelExten |
| | | 10 | | where TServiceModelExtensionElement : ServiceModelExtensionElement |
| | | 11 | | { |
| | | 12 | | private ConfigurationPropertyCollection _properties = null; |
| | | 13 | | |
| | | 14 | | protected NamedServiceModelExtensionCollectionElement(string extensionCollectionName, string name) |
| | 20 | 15 | | : base(extensionCollectionName) |
| | | 16 | | { |
| | 20 | 17 | | if (!string.IsNullOrEmpty(name)) |
| | | 18 | | { |
| | 0 | 19 | | Name = name; |
| | | 20 | | } |
| | | 21 | | else |
| | | 22 | | { |
| | 20 | 23 | | Name = string.Empty; |
| | | 24 | | } |
| | 20 | 25 | | } |
| | | 26 | | |
| | | 27 | | [ConfigurationProperty(ConfigurationStrings.Name, Options = ConfigurationPropertyOptions.IsKey)] |
| | | 28 | | [StringValidator(MinLength = 0)] |
| | | 29 | | public string Name |
| | | 30 | | { |
| | 80 | 31 | | get { return (string)base[ConfigurationStrings.Name]; } |
| | | 32 | | set |
| | | 33 | | { |
| | 20 | 34 | | if (string.IsNullOrEmpty(value)) |
| | | 35 | | { |
| | 20 | 36 | | value = string.Empty; |
| | | 37 | | } |
| | 20 | 38 | | base[ConfigurationStrings.Name] = value; |
| | 20 | 39 | | } |
| | | 40 | | } |
| | | 41 | | |
| | | 42 | | protected override ConfigurationPropertyCollection Properties |
| | | 43 | | { |
| | | 44 | | get |
| | | 45 | | { |
| | 269 | 46 | | if (_properties == null) |
| | | 47 | | { |
| | 20 | 48 | | _properties = base.Properties; |
| | 20 | 49 | | _properties.Add(new ConfigurationProperty(ConfigurationStrings.Name, typeof(string), null, null, new |
| | | 50 | | } |
| | 269 | 51 | | return _properties; |
| | | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |
| | | 55 | | } |