本文整理汇总了C#中System.ServiceModel.Description.MessagePartDescription类的典型用法代码示例。如果您正苦于以下问题:C# MessagePartDescription类的具体用法?C# MessagePartDescription怎么用?C# MessagePartDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessagePartDescription类属于System.ServiceModel.Description命名空间,在下文中一共展示了MessagePartDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPingToContractDescription
/// <summary>
/// Add the Ping method to the existing contract
/// </summary>
private void AddPingToContractDescription(ContractDescription contractDescription)
{
OperationDescription pingOperationDescription = new OperationDescription(PingOperationName, contractDescription);
MessageDescription inputMessageDescription = new MessageDescription(
GetAction(contractDescription, PingOperationName),
MessageDirection.Input);
MessageDescription outputMessageDescription = new MessageDescription(
GetAction(contractDescription, PingResponse),
MessageDirection.Output);
MessagePartDescription returnValue = new MessagePartDescription("PingResult", contractDescription.Namespace);
returnValue.Type = typeof(DateTime);
outputMessageDescription.Body.ReturnValue = returnValue;
inputMessageDescription.Body.WrapperName = PingOperationName;
inputMessageDescription.Body.WrapperNamespace = contractDescription.Namespace;
outputMessageDescription.Body.WrapperName = PingResponse;
outputMessageDescription.Body.WrapperNamespace = contractDescription.Namespace;
pingOperationDescription.Messages.Add(inputMessageDescription);
pingOperationDescription.Messages.Add(outputMessageDescription);
pingOperationDescription.Behaviors.Add(new DataContractSerializerOperationBehavior(pingOperationDescription));
pingOperationDescription.Behaviors.Add(new PingOperationBehavior());
contractDescription.Operations.Add(pingOperationDescription);
}
示例2: ValidateMessagePartDescription
private void ValidateMessagePartDescription(MessagePartDescription part)
{
if (part != null)
{
this.ValidateCustomSerializableType(part.Type);
}
}
示例3: Add
internal void Add(MessagePartDescription part, XmlMemberMapping memberMapping, XmlMembersMapping membersMapping, bool isEncoded)
{
PartInfo partInfo = new PartInfo();
partInfo.MemberMapping = memberMapping;
partInfo.MembersMapping = membersMapping;
partInfo.IsEncoded = isEncoded;
partInfoTable[part] = partInfo;
}
示例4: CreateReflectionMember
private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
{
XmlReflectionMember m = new XmlReflectionMember ();
m.IsReturnValue = isReturnValue;
m.MemberName = partDesc.Name;
m.MemberType = partDesc.Type;
return m;
}
示例5: CreateReflectionMember
private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
{
XmlReflectionMember m = new XmlReflectionMember ();
m.IsReturnValue = isReturnValue;
m.MemberName = partDesc.Name;
m.MemberType = partDesc.Type;
m.XmlAttributes = partDesc.MemberInfo == null ? new XmlAttributes () : new XmlAttributes (partDesc.MemberInfo);
return m;
}
示例6: RequestMessagePartDescription
public RequestMessagePartDescription(MessagePartDescription messagePart, MessagePartType partType, string alias)
: base(messagePart.Name, messagePart.Namespace)
{
Index = messagePart.Index;
MemberInfo = messagePart.MemberInfo;
Multiple = messagePart.Multiple;
ProtectionLevel = messagePart.ProtectionLevel;
Type = messagePart.Type;
Alias = alias;
PartType = partType;
}
示例7: GetXmlReflectionMember
internal static XmlReflectionMember GetXmlReflectionMember(MessagePartDescription part, bool isRpc, bool isEncoded, bool isWrapped)
{
string ns = isRpc ? null : part.Namespace;
ICustomAttributeProvider additionalAttributesProvider = null;
if (isEncoded || (part.AdditionalAttributesProvider is MemberInfo))
{
additionalAttributesProvider = part.AdditionalAttributesProvider;
}
System.ServiceModel.Description.XmlName memberName = string.IsNullOrEmpty(part.UniquePartName) ? null : new System.ServiceModel.Description.XmlName(part.UniquePartName, true);
System.ServiceModel.Description.XmlName xmlName = part.XmlName;
return GetXmlReflectionMember(memberName, xmlName, ns, part.Type, additionalAttributesProvider, part.Multiple, isEncoded, isWrapped);
}
示例8: StreamFormatter
private StreamFormatter(MessageDescription messageDescription, MessagePartDescription streamPart, string operationName, bool isRequest)
{
if ((object)streamPart == (object)messageDescription.Body.ReturnValue)
_streamIndex = returnValueIndex;
else
_streamIndex = streamPart.Index;
_wrapperName = messageDescription.Body.WrapperName;
_wrapperNS = messageDescription.Body.WrapperNamespace;
_partName = streamPart.Name;
_partNS = streamPart.Namespace;
_isRequest = isRequest;
_operationName = operationName;
}
示例9: MessagePartDescription
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;
}
示例10: MessagePartDescription
internal MessagePartDescription(MessagePartDescription other)
{
_name = other._name;
_ns = other._ns;
_index = other._index;
_type = other._type;
_serializationPosition = other._serializationPosition;
_hasProtectionLevel = other._hasProtectionLevel;
_protectionLevel = other._protectionLevel;
_memberInfo = other._memberInfo;
_multiple = other._multiple;
_additionalAttributesProvider = other._additionalAttributesProvider;
_baseType = other._baseType;
_uniquePartName = other._uniquePartName;
}
示例11: AddMessagePartDescription
public static void AddMessagePartDescription(OperationDescription operation, bool isResponse, MessageDescription message, string[] argumentNames, Type[] argumentTypes)
{
string ns = operation.DeclaringContract.Namespace;
for (int i = 0; i < argumentNames.Length; i++)
{
string name = argumentNames[i];
MessagePartDescription item = new MessagePartDescription(NamingHelper.XmlName(name), ns) {
Index = i,
Type = argumentTypes[i]
};
message.Body.Parts.Add(item);
}
if (isResponse)
{
SetReturnValue(message, operation);
}
}
示例12: StreamFormatter
private StreamFormatter(MessageDescription messageDescription, MessagePartDescription streamPart, string operationName, bool isRequest)
{
if (streamPart == messageDescription.Body.ReturnValue)
{
this.streamIndex = -1;
}
else
{
this.streamIndex = streamPart.Index;
}
this.wrapperName = messageDescription.Body.WrapperName;
this.wrapperNS = messageDescription.Body.WrapperNamespace;
this.partName = streamPart.Name;
this.partNS = streamPart.Namespace;
this.isRequest = isRequest;
this.operationName = operationName;
}
示例13: PartInfo
public PartInfo(MessagePartDescription description, XmlDictionaryString dictionaryName, XmlDictionaryString dictionaryNamespace, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
{
_dictionaryName = dictionaryName;
_dictionaryNamespace = dictionaryNamespace;
_itemName = itemName;
_itemNamespace = itemNamespace;
_description = description;
if (description.Type.IsArray)
{
_isArray = true;
_typeCode = description.Type.GetElementType().GetTypeCode();
}
else
{
_isArray = false;
_typeCode = description.Type.GetTypeCode();
}
}
示例14: SerializeBody
private void SerializeBody(XmlDictionaryWriter writer, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, object returnValue, object[] parameters)
{
if (serializer == null)
{
return;
}
bool hasReturnValue = IsValidReturnValue(returnPart);
object[] bodyParameters = new object[bodyParts.Count + (hasReturnValue ? 1 : 0)];
int paramIndex = 0;
if (hasReturnValue)
bodyParameters[paramIndex++] = returnValue;
for (int i = 0; i < bodyParts.Count; i++)
bodyParameters[paramIndex++] = parameters[bodyParts[i].Index];
serializer.Serialize(writer, bodyParameters, null);
}
示例15: IsTypeSupported
private static bool IsTypeSupported(MessagePartDescription bodyDescription)
{
Fx.Assert(bodyDescription != null, "");
Type type = bodyDescription.Type;
if (type == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.SFxMessagePartDescriptionMissingType, bodyDescription.Name, bodyDescription.Namespace)));
if (bodyDescription.Multiple)
return false;
if (type == typeof(void))
return true;
if (type.IsEnum())
return false;
switch (type.GetTypeCode())
{
case TypeCode.Boolean:
case TypeCode.DateTime:
case TypeCode.Decimal:
case TypeCode.Double:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Single:
case TypeCode.String:
return true;
case TypeCode.Object:
if (type.IsArray && type.GetArrayRank() == 1 && IsArrayTypeSupported(type.GetElementType()))
return true;
break;
default:
break;
}
return false;
}