ServiceMetadataEndpointElement.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.ServiceModel.Description;
  9. using System.Configuration;
  10. using System.Collections.Generic;
  11. using System.ServiceModel;
  12. using System.Xml;
  13. using System.Globalization;
  14. public partial class ServiceMetadataEndpointElement : StandardEndpointElement
  15. {
  16. public ServiceMetadataEndpointElement() : base() { }
  17. protected internal override Type EndpointType
  18. {
  19. get { return typeof(ServiceMetadataEndpoint); }
  20. }
  21. protected internal override ServiceEndpoint CreateServiceEndpoint(ContractDescription contractDescription)
  22. {
  23. return new ServiceMetadataEndpoint();
  24. }
  25. protected override void OnInitializeAndValidate(ChannelEndpointElement channelEndpointElement)
  26. {
  27. if (String.IsNullOrEmpty(channelEndpointElement.Binding))
  28. {
  29. channelEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName;
  30. }
  31. channelEndpointElement.Contract = ServiceMetadataBehavior.MexContractName;
  32. }
  33. protected override void OnInitializeAndValidate(ServiceEndpointElement serviceEndpointElement)
  34. {
  35. if (String.IsNullOrEmpty(serviceEndpointElement.Binding))
  36. {
  37. serviceEndpointElement.Binding = ConfigurationStrings.MexHttpBindingCollectionElementName;
  38. }
  39. serviceEndpointElement.Contract = ServiceMetadataBehavior.MexContractName;
  40. serviceEndpointElement.IsSystemEndpoint = true;
  41. }
  42. protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
  43. {
  44. //no additional configuration is required for MEX.
  45. }
  46. protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ChannelEndpointElement serviceEndpointElement)
  47. {
  48. //no additional configuration is required for MEX.
  49. }
  50. }
  51. }