PageRenderTime 282ms CodeModel.GetById 269ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/WCFWebApi/src/Microsoft.ApplicationServer.Http/Microsoft/ApplicationServer/Http/Configuration/HttpMemoryBindingElement.cs

#
C# | 85 lines | 46 code | 8 blank | 31 comment | 2 complexity | a9636704924524cf792b579a8dd4485a MD5 | raw file
 1// <copyright>
 2//   Copyright (c) Microsoft Corporation.  All rights reserved.
 3// </copyright>
 4
 5namespace Microsoft.ApplicationServer.Http.Configuration
 6{
 7    using System;
 8    using System.Configuration;
 9    using System.ServiceModel;
10    using System.ServiceModel.Channels;
11    using System.ServiceModel.Configuration;
12    using Microsoft.ServiceModel;
13    using Microsoft.ServiceModel.Channels;
14    using Microsoft.ServiceModel.Configuration;
15
16    /// <summary>
17    /// A configuration element for the <see cref="HttpMemoryBinding"/> binding. 
18    /// </summary>
19    public class HttpMemoryBindingElement : StandardBindingElement
20    {
21        private ConfigurationPropertyCollection properties;
22
23        /// <summary>
24        /// Initializes a new instance of the <see cref="HttpMemoryBindingElement"/> class and specifies 
25        /// the name of the element. 
26        /// </summary>
27        /// <param name="name">The name that is used for this binding configuration element</param>
28        public HttpMemoryBindingElement(string name)
29            : base(name)
30        {
31        }
32
33        /// <summary>
34        /// Initializes a new instance of the <see cref="HttpMemoryBindingElement"/> class.
35        /// </summary>
36        public HttpMemoryBindingElement()
37            : this(null)
38        {
39        }
40
41        /// <summary>
42        /// Gets the <see cref="Type"/> of binding that this configuration element represents. 
43        /// </summary>
44        /// <returns>A <see cref="Type"/> object that represents the custom binding type.</returns>
45        protected override Type BindingElementType
46        {
47            get
48            {
49                return typeof(HttpMemoryBinding);
50            }
51        }
52
53        /// <summary>
54        /// Gets a <see cref="ConfigurationPropertyCollection"/> instance that contains a collection of <see cref="ConfigurationProperty"/> 
55        /// objects that can be attributes or <see cref="ConfigurationElement"/> objects of this configuration element.
56        /// </summary>
57        /// <returns>A <see cref="ConfigurationPropertyCollection"/> instance that contains a collection of <see cref="ConfigurationProperty"/> 
58        /// objects that can be attributes or <see cref="ConfigurationElement"/> objects of this configuration element.</returns>
59        protected override ConfigurationPropertyCollection Properties
60        {
61            get
62            {
63                if (this.properties == null)
64                {
65                    ConfigurationPropertyCollection baseProperties = base.Properties;
66                    baseProperties.Add(new ConfigurationProperty(ConfigurationStrings.HostNameComparisonMode, typeof(HostNameComparisonMode), HostNameComparisonMode.StrongWildcard, null, new ServiceModelEnumValidator(typeof(HostNameComparisonModeHelper)), ConfigurationPropertyOptions.None));
67                    this.properties = baseProperties;
68                }
69
70                return this.properties;
71            }
72        }
73
74        /// <summary>
75        /// Applies the configuration of the the <see cref="HttpMemoryBindingElement"/> to the given
76        /// <see cref="HttpMemoryBinding"/> instance.
77        /// </summary>
78        /// <param name="binding">The <see cref="HttpMemoryBinding"/> 
79        /// instance to which the <see cref="HttpMemoryBindingElement"/> configuration will be applied.
80        /// </param>
81        protected override void OnApplyConfiguration(Binding binding)
82        {
83        }
84    }
85}