| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- //------------------------------------------------------------
- // 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;
- }
- }
- }
|