ContextBindingElementExtensionElement.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System;
  7. using System.Configuration;
  8. using System.Diagnostics.CodeAnalysis;
  9. using System.Net.Security;
  10. using System.Runtime;
  11. using System.Runtime.CompilerServices;
  12. using System.ServiceModel.Channels;
  13. using System.ServiceModel.Security;
  14. [TypeForwardedFrom("System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
  15. public partial class ContextBindingElementExtensionElement : BindingElementExtensionElement
  16. {
  17. internal const string ContextExchangeMechanismName = "contextExchangeMechanism";
  18. internal const string ContextManagementEnabledName = "contextManagementEnabled";
  19. const string ProtectionLevelName = "protectionLevel";
  20. public ContextBindingElementExtensionElement()
  21. : base()
  22. {
  23. }
  24. [SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationPropertyAttributeRule, MessageId = "System.ServiceModel.Configuration.ContextBindingElementExtensionElement.BindingElementType",
  25. Justification = "This property is not supposed to be exposed in config.")]
  26. public override Type BindingElementType
  27. {
  28. get { return typeof(ContextBindingElement); }
  29. }
  30. [ConfigurationProperty(ConfigurationStrings.ClientCallbackAddressName, DefaultValue = null)]
  31. [SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule,
  32. Justification = "Is of type Uri, we don't have a validator for it")]
  33. public Uri ClientCallbackAddress
  34. {
  35. get { return (Uri)base[ConfigurationStrings.ClientCallbackAddressName]; }
  36. set { base[ConfigurationStrings.ClientCallbackAddressName] = value; }
  37. }
  38. [ConfigurationProperty(ContextExchangeMechanismName, DefaultValue = ContextBindingElement.DefaultContextExchangeMechanism)]
  39. [ServiceModelEnumValidator(typeof(ContextExchangeMechanismHelper))]
  40. public ContextExchangeMechanism ContextExchangeMechanism
  41. {
  42. get { return (ContextExchangeMechanism)base[ContextExchangeMechanismName]; }
  43. set { base[ContextExchangeMechanismName] = value; }
  44. }
  45. [ConfigurationProperty(ProtectionLevelName, DefaultValue = ContextBindingElement.DefaultProtectionLevel)]
  46. [ServiceModelEnumValidator(typeof(ProtectionLevelHelper))]
  47. public ProtectionLevel ProtectionLevel
  48. {
  49. get { return (ProtectionLevel) base[ProtectionLevelName]; }
  50. set { base[ProtectionLevelName] = value; }
  51. }
  52. [ConfigurationProperty(ContextManagementEnabledName, DefaultValue = ContextBindingElement.DefaultContextManagementEnabled)]
  53. public bool ContextManagementEnabled
  54. {
  55. get { return (bool)base[ContextManagementEnabledName]; }
  56. set { base[ContextManagementEnabledName] = value; }
  57. }
  58. protected internal override BindingElement CreateBindingElement()
  59. {
  60. return new ContextBindingElement(this.ProtectionLevel, this.ContextExchangeMechanism, this.ClientCallbackAddress, this.ContextManagementEnabled);
  61. }
  62. }
  63. }