本文整理汇总了C#中System.ServiceModel.Description.WsdlContractConversionContext.AddMessage方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlContractConversionContext.AddMessage方法的具体用法?C# WsdlContractConversionContext.AddMessage怎么用?C# WsdlContractConversionContext.AddMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Description.WsdlContractConversionContext
的用法示例。
在下文中一共展示了WsdlContractConversionContext.AddMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportContract
public override void ExportContract(ContractDescription contract)
{
if (this.isFaulted)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.WsdlExporterIsFaulted)));
if (contract == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contract");
if (!this.exportedContracts.ContainsKey(contract))
{
try
{
WsdlNS.PortType wsdlPortType = CreateWsdlPortType(contract);
WsdlContractConversionContext contractContext;
contractContext = new WsdlContractConversionContext(contract, wsdlPortType);
foreach (OperationDescription operation in contract.Operations)
{
bool isWildcardAction;
if (!OperationIsExportable(operation, out isWildcardAction))
{
string warningMsg = isWildcardAction ? SR.GetString(SR.WarnSkippingOpertationWithWildcardAction, contract.Name, contract.Namespace, operation.Name)
: SR.GetString(SR.WarnSkippingOpertationWithSessionOpenNotificationEnabled, "Action", OperationDescription.SessionOpenedAction, contract.Name, contract.Namespace, operation.Name);
LogExportWarning(warningMsg);
continue;
}
WsdlNS.Operation wsdlOperation = CreateWsdlOperation(operation, contract);
wsdlPortType.Operations.Add(wsdlOperation);
contractContext.AddOperation(operation, wsdlOperation);
foreach (MessageDescription message in operation.Messages)
{
//Create Operation Message
WsdlNS.OperationMessage wsdlOperationMessage = CreateWsdlOperationMessage(message);
wsdlOperation.Messages.Add(wsdlOperationMessage);
contractContext.AddMessage(message, wsdlOperationMessage);
}
foreach (FaultDescription fault in operation.Faults)
{
//Create Operation Fault
WsdlNS.OperationFault wsdlOperationFault = CreateWsdlOperationFault(fault);
wsdlOperation.Faults.Add(wsdlOperationFault);
contractContext.AddFault(fault, wsdlOperationFault);
}
}
CallExportContract(contractContext);
exportedContracts.Add(contract, contractContext);
}
catch
{
isFaulted = true;
throw;
}
}
}
示例2: ExportContract
public override void ExportContract(ContractDescription contract)
{
if (this.isFaulted)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("WsdlExporterIsFaulted")));
}
if (contract == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contract");
}
if (!this.exportedContracts.ContainsKey(contract))
{
try
{
PortType wsdlPortType = this.CreateWsdlPortType(contract);
WsdlContractConversionContext contractContext = new WsdlContractConversionContext(contract, wsdlPortType);
foreach (OperationDescription description in contract.Operations)
{
if (!OperationIsExportable(description))
{
string warningMessage = System.ServiceModel.SR.GetString("WarnSkippingOprtationWithWildcardAction", new object[] { contract.Name, contract.Namespace, description.Name });
this.LogExportWarning(warningMessage);
}
else
{
Operation operation = this.CreateWsdlOperation(description, contract);
wsdlPortType.Operations.Add(operation);
contractContext.AddOperation(description, operation);
foreach (MessageDescription description2 in description.Messages)
{
OperationMessage operationMessage = this.CreateWsdlOperationMessage(description2);
operation.Messages.Add(operationMessage);
contractContext.AddMessage(description2, operationMessage);
}
foreach (FaultDescription description3 in description.Faults)
{
OperationFault operationFaultMessage = this.CreateWsdlOperationFault(description3);
operation.Faults.Add(operationFaultMessage);
contractContext.AddFault(description3, operationFaultMessage);
}
}
}
this.CallExportContract(contractContext);
this.exportedContracts.Add(contract, contractContext);
}
catch
{
this.isFaulted = true;
throw;
}
}
}