本文整理汇总了C#中System.ServiceModel.Description.WsdlContractConversionContext类的典型用法代码示例。如果您正苦于以下问题:C# WsdlContractConversionContext类的具体用法?C# WsdlContractConversionContext怎么用?C# WsdlContractConversionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WsdlContractConversionContext类属于System.ServiceModel.Description命名空间,在下文中一共展示了WsdlContractConversionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WsdlEndpointConversionContext
internal WsdlEndpointConversionContext (WsdlContractConversionContext context, ServiceEndpoint endpoint, Port port, WSBinding wsdlBinding)
{
this.context = context;
this.endpoint = endpoint;
this.port = port;
this.wsdl_binding = wsdlBinding;
}
示例2: foreach
/// <summary>
/// When ExportContract is called to generate the necessary metadata, we inspect the service
/// contract and build a list of parameters that we'll need to adjust the XSD for later.
/// </summary>
void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
_requiredParameter = new List<RequiredMessagePart>();
foreach (var operation in context.Contract.Operations)
{
var inputMessage = operation.Messages.Where(m => m.Direction == MessageDirection.Input).First();
var parameters = operation.SyncMethod.GetParameters();
Debug.Assert(parameters.Length == inputMessage.Body.Parts.Count);
for (int i = 0; i < parameters.Length; i++)
{
object[] attributes = parameters[i].GetCustomAttributes(typeof(OptionalAttribute), false);
if (attributes.Length == 0)
{
// The parameter has no [Optional] attribute, add it to the list of parameters
// that we need to adjust the XML schema for later on.
_requiredParameter.Add(new RequiredMessagePart()
{
Namespace = inputMessage.Body.Parts[i].Namespace,
Message = operation.Name,
Name = inputMessage.Body.Parts[i].Name
});
}
}
}
}
示例3: CallExportContract
private void CallExportContract(WsdlContractConversionContext contractContext)
{
foreach (IWsdlExportExtension extension in contractContext.ExportExtensions)
{
this.CallExtension(contractContext, extension);
}
}
示例4: ArgumentNullException
void IWsdlImportExtension.ImportContract(WsdlImporter importer, WsdlContractConversionContext contractContext)
{
if (contractContext == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("contractContext"));
MessageContractImporter.ImportMessageContract(importer, contractContext, MessageContractImporter.XmlSerializerSchemaImporter.Get(importer));
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:DataContractSerializerMessageContractImporter.cs
示例5: ArgumentNullException
void IWsdlImportExtension.ImportContract (WsdlImporter importer,
WsdlContractConversionContext context)
{
if (!enabled)
return;
if (importer == null)
throw new ArgumentNullException ("importer");
if (context == null)
throw new ArgumentNullException ("context");
if (this.importer != null || this.context != null)
throw new SystemException ("INTERNAL ERROR: unexpected recursion of ImportContract method call");
dc_importer = new XsdDataContractImporter ();
schema_set_in_use = new XmlSchemaSet ();
schema_set_in_use.Add (importer.XmlSchemas);
foreach (WSDL wsdl in importer.WsdlDocuments)
foreach (XmlSchema xs in wsdl.Types.Schemas)
schema_set_in_use.Add (xs);
// commenting out this import operation, but might be required (I guess not).
//dc_importer.Import (schema_set_in_use);
schema_set_in_use.Compile ();
this.importer = importer;
this.context = context;
try {
DoImportContract ();
} finally {
this.importer = null;
this.context = null;
}
}
示例6: ExportContract
//
// IWsdlExportExtension Implementation
//
public void ExportContract(
WsdlExporter exporter,
WsdlContractConversionContext context
)
{
// never called
}
示例7: ArgumentNullException
void IWsdlImportExtension.ImportContract (WsdlImporter importer,
WsdlContractConversionContext context)
{
if (!enabled)
return;
if (importer == null)
throw new ArgumentNullException ("importer");
if (context == null)
throw new ArgumentNullException ("context");
if (this.importer != null || this.context != null)
throw new SystemException ("INTERNAL ERROR: unexpected recursion of ImportContract method call");
#if USE_DATA_CONTRACT_IMPORTER
dc_importer = new XsdDataContractImporter ();
schema_set_in_use = new XmlSchemaSet ();
schema_set_in_use.Add (importer.XmlSchemas);
foreach (WSDL wsdl in importer.WsdlDocuments)
foreach (XmlSchema xs in wsdl.Types.Schemas)
schema_set_in_use.Add (xs);
dc_importer.Import (schema_set_in_use);
#endif
this.importer = importer;
this.context = context;
try {
DoImportContract ();
} finally {
this.importer = null;
this.context = null;
}
}
示例8: MessageContractExporter
protected MessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension)
{
this.exporter = exporter;
this.contractContext = context;
this.operation = operation;
this.extension = extension;
}
示例9:
void IWsdlImportExtension.ImportContract (WsdlImporter importer,
WsdlContractConversionContext context)
{
if (!Enabled)
return;
impl.ImportContract (importer, context);
}
示例10: ImportContract
/// <summary>Called when importing a contract.</summary>
/// <param name="importer">The importer.</param>
/// <param name="context">The import context to be modified.</param>
public void ImportContract(WsdlImporter importer, WsdlContractConversionContext context)
{
// Ensure that the client class has been appropriately created in order for us to add methods to it.
context.Contract.Behaviors.Add(new TaskAsyncServiceContractGenerationExtension());
// For each operation, add a task-based async equivalent.
foreach (Operation operation in context.WsdlPortType.Operations)
{
var description = context.Contract.Operations.Find(operation.Name);
if (description != null)
description.Behaviors.Add(new TaskAsyncOperationContractGenerationExtension());
}
}
示例11: CallExtension
private void CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
{
try
{
extension.ExportContract(this, contractContext);
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(this.ThrowExtensionException(contractContext.Contract, extension, exception));
}
}
示例12: GetDocumentation
void IWsdlImportExtension.ImportContract(WsdlImporter importer, WsdlContractConversionContext context)
{
string documentation = GetDocumentation(context.WsdlPortType);
context.Contract.Behaviors.Add(new XmlCommentsSvcExtension(this, documentation));
foreach (Operation operation in context.WsdlPortType.Operations)
{
documentation = GetDocumentation(operation);
if (!String.IsNullOrEmpty(documentation))
{
OperationDescription operationDescription = context.Contract.Operations.Find(operation.Name);
operationDescription.Behaviors.Add(new XmlCommentsOpExtension(this, documentation));
}
}
}
示例13:
void IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
// This is either for a service contract or operation, so set documentation accordingly.
if (_contractDescription != null)
{
// Attribute was applied to a contract.
context.WsdlPortType.Documentation = this.Text;
}
else
{
// Attribute was applied to an operation.
Operation operation = context.GetOperation(_operationDescription);
if (operation != null)
{
operation.Documentation = this.Text;
}
}
}
示例14: ImportFaultSoapAction
static void ImportFaultSoapAction(WsdlContractConversionContext contractContext, FaultDescription fault, FaultBinding wsdlFaultBinding)
{
string soapAction = SoapHelper.ReadSoapAction(wsdlFaultBinding.OperationBinding);
if (contractContext != null)
{
OperationFault wsdlOperationFault = contractContext.GetOperationFault(fault);
string wsaAction = WsdlImporter.WSAddressingHelper.FindWsaActionAttribute(wsdlOperationFault);
if (wsaAction == null && soapAction != null)
fault.Action = soapAction;
//
}
else
{
//
}
}
示例15: ExportContract
public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
XsdDataContractExporter xsdInventoryExporter;
object dataContractExporter;
if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter))
{
xsdInventoryExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas);
exporter.State.Add(typeof(XsdDataContractExporter), xsdInventoryExporter);
}
else
{
xsdInventoryExporter = (XsdDataContractExporter)dataContractExporter;
}
if (xsdInventoryExporter.Options == null)
{
xsdInventoryExporter.Options = new ExportOptions();
}
xsdInventoryExporter.Options.DataContractSurrogate = this.surrogate;
}