BindingElementExtensionElement.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System;
  7. using System.ServiceModel.Channels;
  8. using System.Configuration;
  9. using System.Globalization;
  10. using System.Xml;
  11. public abstract class BindingElementExtensionElement : ServiceModelExtensionElement
  12. {
  13. public virtual void ApplyConfiguration(BindingElement bindingElement)
  14. {
  15. // Some items make sense just as tags and have no other configuration
  16. if (null == bindingElement)
  17. {
  18. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement");
  19. }
  20. }
  21. public abstract Type BindingElementType
  22. {
  23. get;
  24. }
  25. protected internal abstract BindingElement CreateBindingElement();
  26. protected internal virtual void InitializeFrom(BindingElement bindingElement)
  27. {
  28. if (bindingElement == null)
  29. {
  30. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement");
  31. }
  32. if (bindingElement.GetType() != this.BindingElementType)
  33. {
  34. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement",
  35. SR.GetString(SR.ConfigInvalidTypeForBindingElement,
  36. this.BindingElementType.ToString(),
  37. bindingElement.GetType().ToString()));
  38. }
  39. }
  40. }
  41. }