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 161
|
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.Description
{
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net.Security;
using System.Reflection;
using System.ServiceModel.Security;
[DebuggerDisplay("Name={name}, Namespace={ns}, Type={Type}, Index={index}}")]
public class MessagePartDescription
{
XmlName name;
string ns;
int index;
Type type;
int serializationPosition;
ProtectionLevel protectionLevel;
bool hasProtectionLevel;
MemberInfo memberInfo;
ICustomAttributeProvider additionalAttributesProvider;
bool multiple;
string baseType;
string uniquePartName;
public MessagePartDescription(string name, string ns)
{
if (name == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name", SR.GetString(SR.SFxParameterNameCannotBeNull));
}
this.name = new XmlName(name, true /*isEncoded*/);
if (!string.IsNullOrEmpty(ns))
{
NamingHelper.CheckUriParameter(ns, "ns");
}
this.ns = ns;
}
internal MessagePartDescription(MessagePartDescription other)
{
this.name = other.name;
this.ns = other.ns;
this.index = other.index;
this.type = other.type;
this.serializationPosition = other.serializationPosition;
this.hasProtectionLevel = other.hasProtectionLevel;
this.protectionLevel = other.protectionLevel;
this.memberInfo = other.memberInfo;
this.multiple = other.multiple;
this.additionalAttributesProvider = other.additionalAttributesProvider;
this.baseType = other.baseType;
this.uniquePartName = other.uniquePartName;
}
internal virtual MessagePartDescription Clone()
{
return new MessagePartDescription(this);
}
internal string BaseType
{
get { return this.baseType; }
set { this.baseType = value; }
}
internal XmlName XmlName
{
get { return this.name; }
}
internal string CodeName
{
get { return this.name.DecodedName; }
}
public string Name
{
get { return this.name.EncodedName; }
}
public string Namespace
{
get { return this.ns; }
}
public Type Type
{
get { return type; }
set { type = value; }
}
public int Index
{
get { return index; }
set { index = value; }
}
[DefaultValue(false)]
public bool Multiple
{
get { return this.multiple; }
set { this.multiple = value; }
}
public ProtectionLevel ProtectionLevel
{
get { return this.protectionLevel; }
set
{
if (!ProtectionLevelHelper.IsDefined(value))
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
this.protectionLevel = value;
this.hasProtectionLevel = true;
}
}
public bool HasProtectionLevel
{
get { return this.hasProtectionLevel; }
}
public MemberInfo MemberInfo
{
get { return this.memberInfo; }
set { this.memberInfo = value; }
}
internal ICustomAttributeProvider AdditionalAttributesProvider
{
get { return this.additionalAttributesProvider ?? this.memberInfo; }
set { this.additionalAttributesProvider = value; }
}
internal string UniquePartName
{
get { return this.uniquePartName; }
set { this.uniquePartName = value; }
}
internal int SerializationPosition
{
get { return serializationPosition; }
set { serializationPosition = value; }
}
internal void ResetProtectionLevel()
{
this.protectionLevel = ProtectionLevel.None;
this.hasProtectionLevel = false;
}
}
}
|