MetadataReference.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel.Description
  5. {
  6. using System;
  7. using System.ServiceModel;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using System.Xml;
  11. using System.Xml.Serialization;
  12. using System.Collections.ObjectModel;
  13. using WsdlNS = System.Web.Services.Description;
  14. using System.ServiceModel.Channels;
  15. [XmlRoot(ElementName = MetadataStrings.MetadataExchangeStrings.MetadataReference, Namespace = MetadataStrings.MetadataExchangeStrings.Namespace)]
  16. public class MetadataReference : IXmlSerializable
  17. {
  18. EndpointAddress address;
  19. AddressingVersion addressVersion;
  20. Collection<XmlAttribute> attributes = new Collection<XmlAttribute>();
  21. static XmlDocument Document = new XmlDocument();
  22. public MetadataReference()
  23. {
  24. }
  25. public MetadataReference(EndpointAddress address, AddressingVersion addressVersion)
  26. {
  27. this.address = address;
  28. this.addressVersion = addressVersion;
  29. }
  30. public EndpointAddress Address
  31. {
  32. get { return this.address; }
  33. set { this.address = value; }
  34. }
  35. public AddressingVersion AddressVersion
  36. {
  37. get { return this.addressVersion; }
  38. set { this.addressVersion = value; }
  39. }
  40. System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema()
  41. {
  42. return null;
  43. }
  44. void IXmlSerializable.ReadXml(XmlReader reader)
  45. {
  46. this.address = EndpointAddress.ReadFrom(XmlDictionaryReader.CreateDictionaryReader(reader), out this.addressVersion);
  47. }
  48. void IXmlSerializable.WriteXml(XmlWriter writer)
  49. {
  50. if (address != null)
  51. {
  52. address.WriteContentsTo(this.addressVersion, writer);
  53. }
  54. }
  55. }
  56. }