• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Description.WsdlContractConversionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ServiceModel.Description.WsdlContractConversionContext的典型用法代码示例。如果您正苦于以下问题:C# WsdlContractConversionContext类的具体用法?C# WsdlContractConversionContext怎么用?C# WsdlContractConversionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WsdlContractConversionContext类属于System.ServiceModel.Description命名空间,在下文中一共展示了WsdlContractConversionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:WsdlEndpointConversionContext.cs


示例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
                    });
                }
            }
        }
    }
开发者ID:mtazva,项目名称:Snippets,代码行数:31,代码来源:RequiredParametersBehaviorAttribute.cs


示例3: CallExportContract

 private void CallExportContract(WsdlContractConversionContext contractContext)
 {
     foreach (IWsdlExportExtension extension in contractContext.ExportExtensions)
     {
         this.CallExtension(contractContext, extension);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:WsdlExporter.cs


示例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;
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:33,代码来源:DataContractSerializerMessageContractImporter.cs


示例6: ExportContract

 //
 // IWsdlExportExtension Implementation
 //
 public void ExportContract(
     WsdlExporter exporter,
     WsdlContractConversionContext context
     )
 {
     // never called
 }
开发者ID:JonasSyrstad,项目名称:Stardust,代码行数:10,代码来源:InlineXsdInWsdlBehavior.cs


示例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;
			}
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:32,代码来源:DataContractSerializerMessageContractImporter.cs


示例8: MessageContractExporter

 protected MessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension)
 {
     this.exporter = exporter;
     this.contractContext = context;
     this.operation = operation;
     this.extension = extension;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:MessageContractExporter.cs


示例9:

		void IWsdlImportExtension.ImportContract (WsdlImporter importer,
			WsdlContractConversionContext context)
		{
			if (!Enabled)
				return;

			impl.ImportContract (importer, context);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:DataContractSerializerMessageContractImporter.cs


示例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());
            }
        }
开发者ID:StephenCleary,项目名称:AsyncCTPUtil,代码行数:16,代码来源:TaskAsyncWsdlImportExtension.cs


示例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));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:WsdlExporter.cs


示例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));
                }
            }
        }
开发者ID:anukat2015,项目名称:sones,代码行数:15,代码来源:XmlCommentsImporter.cs


示例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;
         }
     }
 }
开发者ID:dsiderova,项目名称:SiLADemoProviderWCF,代码行数:18,代码来源:WsdlDocumentationAttribute.cs


示例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
            {
                //
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:MessageEncodingBindingElementImporter.cs


示例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;
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:21,代码来源:DomainServiceWsdlExportExtension.cs


示例16: ExportContract

        public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
        {
            if (exporter == null)
                throw new ArgumentNullException("exporter");

            object dataContractExporter;
            XsdDataContractExporter xsdDCExporter;
            if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter))
            {
                xsdDCExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas);
                exporter.State.Add(typeof(XsdDataContractExporter), xsdDCExporter);
            }
            else
            {
                xsdDCExporter = (XsdDataContractExporter)dataContractExporter;
            }
            if (xsdDCExporter.Options == null)
                xsdDCExporter.Options = new ExportOptions();

            if (xsdDCExporter.Options.DataContractSurrogate == null)
                xsdDCExporter.Options.DataContractSurrogate = new AllowNonSerializableTypesSurrogate();
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:22,代码来源:AllowNonSerializableTypesAttribute.cs


示例17: 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");

			this.importer = importer;
			this.context = context;
			try {
				DoImportContract ();
			} finally {
				this.importer = null;
				this.context = null;
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:22,代码来源:DataContractSerializerMessageContractImporter.cs


示例18: ImportContract

 public void ImportContract(WsdlImporter importer, WsdlContractConversionContext context)
 {
     // Contract Documentation
     if (context.WsdlPortType.Documentation != null)
     {
         // System examines the contract behaviors to see whether any implement IWsdlImportExtension.
         context.Contract.Behaviors.Add(new WsdlDocumentationImporter(context.WsdlPortType.Documentation));
     }
     // Operation Documentation
     foreach (Operation operation in context.WsdlPortType.Operations)
     {
         if (operation.Documentation != null)
         {
             OperationDescription operationDescription = context.Contract.Operations.Find(operation.Name);
             if (operationDescription != null)
             {
                 // System examines the operation behaviors to see whether any implement IWsdlImportExtension.
                 operationDescription.Behaviors.Add(new WsdlDocumentationImporter(operation.Documentation));
             }
         }
     }
 }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:22,代码来源:WsdlDocumentationImporter.cs


示例19: ExportContractInternal

		List<IWsdlExportExtension> ExportContractInternal (ContractDescription contract)
		{
			QName qname = new QName (contract.Name, contract.Namespace);
			if (ExportedContracts.ContainsKey (qname))
				throw new ArgumentException (String.Format (
					"A ContractDescription with Namespace : {0} and Name : {1} has already been exported.", 
					contract.Namespace, contract.Name));

			WSServiceDescription sd = GetServiceDescription (contract.Namespace);

			List<IWsdlExportExtension> extensions = new List<IWsdlExportExtension> ();
			foreach (IWsdlExportExtension extn in contract.Behaviors.FindAll<IWsdlExportExtension> ())
				extensions.Add (extn);

			XmlDocument xdoc = new XmlDocument ();

			PortType ws_port = new PortType ();
			ws_port.Name = contract.Name;

			foreach (OperationDescription sm_op in contract.Operations) {
				Operation ws_op = new Operation ();
				ws_op.Name = sm_op.Name;

				foreach (MessageDescription sm_md in sm_op.Messages) {
					//OperationMessage
					OperationMessage ws_opmsg;
					WSMessage ws_msg = new WSMessage ();
					MessagePart ws_msgpart;
					if (sm_md.Direction == MessageDirection.Input) {
						ws_opmsg = new OperationInput ();
						ws_msg.Name = String.Concat (ws_port.Name, "_", ws_op.Name, "_", "InputMessage");
						ws_msgpart = ExportMessageBodyDescription (sm_md.Body, ws_op.Name, sd.TargetNamespace);
					} else {
						ws_opmsg = new OperationOutput ();
						ws_msg.Name = String.Concat (ws_port.Name, "_", ws_op.Name, "_", "OutputMessage");
						ws_msgpart = ExportMessageBodyDescription (sm_md.Body, ws_op.Name + "Response", sd.TargetNamespace);
					}
					ws_msg.Parts.Add (ws_msgpart);	

					/* FIXME: Faults */

					//Action
					XmlAttribute attr = xdoc.CreateAttribute ("wsaw", "Action", "http://www.w3.org/2006/05/addressing/wsdl");
					attr.Value = sm_md.Action;
					ws_opmsg.ExtensibleAttributes = new XmlAttribute [] { attr };
					
					//FIXME: Set .Input & .Output

					ws_opmsg.Message = new QName (ws_msg.Name, sd.TargetNamespace);
					ws_op.Messages.Add (ws_opmsg);
					sd.Messages.Add (ws_msg);
				}

				ws_port.Operations.Add (ws_op);

				foreach (IWsdlExportExtension extn in sm_op.Behaviors.FindAll<IWsdlExportExtension> ())
					extensions.Add (extn);
			}

			//Add Imports for <types
			XmlSchema xs_import = new XmlSchema ();
			xs_import.TargetNamespace = String.Concat (
					contract.Namespace, 
					contract.Namespace.EndsWith ("/") ? "" : "/",
					"Imports");
			foreach (XmlSchema schema in GeneratedXmlSchemas.Schemas ()) {
				XmlSchemaImport imp = new XmlSchemaImport ();
				imp.Namespace = schema.TargetNamespace;
				xs_import.Includes.Add (imp);
			}
			sd.Types.Schemas.Add (xs_import);

			sd.PortTypes.Add (ws_port);
			ExportedContracts [qname] = contract;

			WsdlContractConversionContext context = new WsdlContractConversionContext (contract, ws_port);
			foreach (IWsdlExportExtension extn in extensions)
				extn.ExportContract (this, context);

			return extensions;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:81,代码来源:WsdlExporter.cs


示例20: DataContractSerializerMessageContractExporter

 internal DataContractSerializerMessageContractExporter(WsdlExporter exporter, WsdlContractConversionContext context, OperationDescription operation, IOperationBehavior extension) : base(exporter, context, operation, extension)
 {
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:3,代码来源:DataContractSerializerMessageContractExporter.cs



注:本文中的System.ServiceModel.Description.WsdlContractConversionContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Description.WsdlEndpointConversionContext类代码示例发布时间:2022-05-26
下一篇:
C# Description.WebHttpBehavior类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap