1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
#region Copyright (c) Microsoft Corporation
/// <copyright company='Microsoft Corporation'>
/// Copyright (c) Microsoft Corporation. All Rights Reserved.
/// Information Contained Herein is Proprietary and Confidential.
/// </copyright>
#endregion
using System;
using System.Diagnostics;
using XmlSerialization = System.Xml.Serialization;
#if WEB_EXTENSIONS_CODE
using System.Web.Resources;
#else
using Microsoft.VSDesigner.WCF.Resources;
#endif
#if WEB_EXTENSIONS_CODE
namespace System.Web.Compilation.WCFModel
#else
namespace Microsoft.VSDesigner.WCFModel
#endif
{
/// <summary>
/// This class implements a MetadataSource item in the svcmap file
/// </summary>
/// <remarks></remarks>
#if WEB_EXTENSIONS_CODE
internal class MetadataSource
#else
[CLSCompliant(true)]
public class MetadataSource
#endif
{
// URL of metadata source
private string m_Address;
// protocol to download it
private string m_Protocol;
// ID of this source
private int m_SourceId;
/// <summary>
/// Constructor
/// </summary>
/// <remarks> Must support a default construct for XmlSerializer</remarks>
public MetadataSource()
{
m_Address = String.Empty;
m_Protocol = String.Empty;
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="protocol"></param>
/// <param name="address"></param>
/// <param name="sourceId"></param>
public MetadataSource(string protocol, string address, int sourceId)
{
if (protocol == null)
{
throw new ArgumentNullException("protocol");
}
if (address == null)
{
throw new ArgumentNullException("address");
}
if (protocol.Length == 0)
{
throw new ArgumentException(WCFModelStrings.ReferenceGroup_EmptyProtocol);
}
if (address == null)
{
throw new ArgumentException(WCFModelStrings.ReferenceGroup_EmptyAddress);
}
m_Protocol = protocol;
m_Address = address;
if (sourceId < 0)
{
Debug.Fail("Source ID shouldn't be a nagtive number");
throw new ArgumentException(WCFModelStrings.ReferenceGroup_InvalidSourceId);
}
m_SourceId = sourceId;
}
/// <summary>
/// URL address to download metadata
/// </summary>
/// <value></value>
/// <remarks></remarks>
[XmlSerialization.XmlAttribute()]
public string Address
{
get
{
return m_Address;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
m_Address = value;
}
}
/// <summary>
/// protocol used to download metadata
/// </summary>
/// <value></value>
/// <remarks></remarks>
[XmlSerialization.XmlAttribute()]
public string Protocol
{
get
{
return m_Protocol;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
m_Protocol = value;
}
}
/// <summary>
/// generated ID for this metadata source
/// </summary>
/// <value></value>
/// <remarks></remarks>
[XmlSerialization.XmlAttribute()]
public int SourceId
{
get
{
return m_SourceId;
}
set
{
if (value < 0)
{
Debug.Fail("Source ID shouldn't be a nagtive number");
throw new ArgumentException(WCFModelStrings.ReferenceGroup_InvalidSourceId);
}
m_SourceId = value;
}
}
}
}
|