本文整理汇总了C#中System.ServiceModel.Description.MessagePartDescription类的典型用法代码示例。如果您正苦于以下问题:C# MessagePartDescription类的具体用法?C# MessagePartDescription怎么用?C# MessagePartDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessagePartDescription类属于System.ServiceModel.Description命名空间,在下文中一共展示了MessagePartDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:serbrech,项目名称:WCFPing,代码行数:33,代码来源:PingEndpointBehavior.cs
示例2: ValidateMessagePartDescription
private void ValidateMessagePartDescription(MessagePartDescription part)
{
if (part != null)
{
this.ValidateCustomSerializableType(part.Type);
}
}
开发者ID:JonasSyrstad,项目名称:Stardust,代码行数:7,代码来源:NewSerializerContract.cs
示例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;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:XmlSerializerOperationGenerator.cs
示例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;
}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:XmlMessagesFormatter.cs
示例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;
}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:XmlMessagesFormatter.cs
示例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;
}
开发者ID:huoxudong125,项目名称:WcfRestContrib,代码行数:11,代码来源:RequestMessagePartDescription.cs
示例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);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:XmlSerializerHelper.cs
示例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;
}
开发者ID:dmetzgar,项目名称:wcf,代码行数:13,代码来源:StreamFormatter.cs
示例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;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:MessagePartDescription.cs
示例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;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:15,代码来源:MessagePartDescription.cs
示例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);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:MessageBuilder.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:StreamFormatter.cs
示例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();
}
}
开发者ID:shijiaxing,项目名称:wcf,代码行数:18,代码来源:PrimitiveOperationFormatter.cs
示例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);
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:19,代码来源:XmlSerializerOperationFormatter.cs
示例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;
}
开发者ID:shijiaxing,项目名称:wcf,代码行数:34,代码来源:PrimitiveOperationFormatter.cs
示例16: AddToDictionary
private static PartInfo AddToDictionary(XmlDictionary dictionary, MessagePartDescription part, bool isRpc)
{
Type type = part.Type;
XmlDictionaryString itemName = null;
XmlDictionaryString itemNamespace = null;
if (type.IsArray && type != typeof(byte[]))
{
const string ns = "http://schemas.microsoft.com/2003/10/Serialization/Arrays";
string name = GetArrayItemName(type.GetElementType());
itemName = AddToDictionary(dictionary, name);
itemNamespace = AddToDictionary(dictionary, ns);
}
return new PartInfo(part,
AddToDictionary(dictionary, part.Name),
AddToDictionary(dictionary, isRpc ? string.Empty : part.Namespace),
itemName, itemNamespace);
}
开发者ID:shijiaxing,项目名称:wcf,代码行数:17,代码来源:PrimitiveOperationFormatter.cs
示例17: ExportDataContract
private void ExportDataContract (MessagePartDescription md)
{
if (data_contract_importer == null)
data_contract_importer = md.DataContractImporter;
else if (md.DataContractImporter != null && data_contract_importer != md.DataContractImporter)
throw new Exception ("INTERNAL ERROR: should not happen");
if (xml_serialization_importer == null)
xml_serialization_importer = md.XmlSerializationImporter;
else if (md.XmlSerializationImporter != null && xml_serialization_importer != md.XmlSerializationImporter)
throw new Exception ("INTERNAL ERROR: should not happen");
}
开发者ID:anand-bhola,项目名称:mono,代码行数:11,代码来源:ServiceContractGenerator.cs
示例18: ValidateMessagePartDescription
/// <summary>
/// Validates the message part description.
/// </summary>
/// <param name="messagePartDescription">The message part description.</param>
private static void ValidateMessagePartDescription(MessagePartDescription messagePartDescription)
{
if (messagePartDescription != null)
{
ValidateJsonSerializableType(messagePartDescription.Type);
}
}
开发者ID:matthijskoopman,项目名称:Catel,代码行数:11,代码来源:ShouldUseJsonSerializationForDataContractsAttribute.cs
示例19: GetSerializer
protected XmlObjectSerializer GetSerializer (WebContentFormat msgfmt, bool isWrapped, MessagePartDescription part)
{
if (part.Type == typeof (void))
return null; // no serialization should be done.
switch (msgfmt) {
case WebContentFormat.Xml:
if (xml_serializer == null)
xml_serializer = isWrapped ? new DataContractSerializer (part.Type, part.Name, part.Namespace) : new DataContractSerializer (part.Type);
return xml_serializer;
case WebContentFormat.Json:
// FIXME: after name argument they are hack
if (json_serializer == null)
json_serializer = isWrapped ? new DataContractJsonSerializer (part.Type, BodyName ?? part.Name, null, 0x100000, false, null, true) : new DataContractJsonSerializer (part.Type);
return json_serializer;
default:
throw new NotImplementedException (msgfmt.ToString ());
}
}
开发者ID:LevNNN,项目名称:mono,代码行数:19,代码来源:WebMessageFormatter.cs
示例20: GetXmlReflectionMember
static internal XmlReflectionMember GetXmlReflectionMember(MessagePartDescription part, bool isRpc, bool isWrapped)
{
string ns = isRpc ? null : part.Namespace;
MemberInfo additionalAttributesProvider = null;
if (part.AdditionalAttributesProvider.MemberInfo != null)
additionalAttributesProvider = part.AdditionalAttributesProvider.MemberInfo;
XmlName memberName = string.IsNullOrEmpty(part.UniquePartName) ? null : new XmlName(part.UniquePartName, true /*isEncoded*/);
XmlName elementName = part.XmlName;
return GetXmlReflectionMember(memberName, elementName, ns, part.Type, additionalAttributesProvider, part.Multiple, isWrapped);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:10,代码来源:XmlSerializerOperationBehavior.cs
注:本文中的System.ServiceModel.Description.MessagePartDescription类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论