| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Xml; |
| | | 5 | | using System.Xml.Serialization; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Description |
| | | 9 | | { |
| | | 10 | | [XmlRoot(ElementName = MetadataStrings.MetadataExchangeStrings.MetadataReference, Namespace = MetadataStrings.Metada |
| | | 11 | | public class MetadataReference : IXmlSerializable |
| | | 12 | | { |
| | | 13 | | private AddressingVersion _addressVersion; |
| | | 14 | | |
| | 0 | 15 | | public MetadataReference() |
| | | 16 | | { |
| | 0 | 17 | | } |
| | | 18 | | |
| | 0 | 19 | | public MetadataReference(EndpointAddress address, AddressingVersion addressVersion) |
| | | 20 | | { |
| | 0 | 21 | | Address = address; |
| | 0 | 22 | | _addressVersion = addressVersion; |
| | 0 | 23 | | } |
| | | 24 | | |
| | 0 | 25 | | public EndpointAddress Address { get; set; } |
| | | 26 | | |
| | | 27 | | public AddressingVersion AddressVersion |
| | | 28 | | { |
| | 0 | 29 | | get { return _addressVersion; } |
| | 0 | 30 | | set { _addressVersion = value; } |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema() |
| | | 34 | | { |
| | 0 | 35 | | return null; |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | void IXmlSerializable.ReadXml(XmlReader reader) |
| | | 39 | | { |
| | 0 | 40 | | Address = EndpointAddress.ReadFrom(XmlDictionaryReader.CreateDictionaryReader(reader), out _addressVersion); |
| | 0 | 41 | | } |
| | | 42 | | |
| | | 43 | | void IXmlSerializable.WriteXml(XmlWriter writer) |
| | | 44 | | { |
| | 0 | 45 | | if (Address != null) |
| | | 46 | | { |
| | 0 | 47 | | Address.WriteContentsTo(_addressVersion, writer); |
| | | 48 | | } |
| | 0 | 49 | | } |
| | | 50 | | } |
| | | 51 | | } |