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