当前位置: 首页>>代码示例>>C#>>正文


C# WsdlContractConversionContext.GetOperation方法代码示例

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


在下文中一共展示了WsdlContractConversionContext.GetOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1:

 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

示例2: ExportContract

        public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
        {
            Debug.WriteLine("Inside ExportContract");
            if (contractDescription != null)
            {
                // Inside this block it is the contract-level comment attribute.
                // This.Text returns the string for the contract attribute.
                // Set the doc element; if this isn't done first, there is no XmlElement in the
                // DocumentElement property.
                context.WsdlPortType.Documentation = string.Empty;
                // Contract comments.
                XmlDocument owner = context.WsdlPortType.DocumentationElement.OwnerDocument;
                XmlElement summaryElement = owner.CreateElement("summary");
                summaryElement.InnerText = this.Text;
                context.WsdlPortType.DocumentationElement.AppendChild(summaryElement);
            }
            else
            {
                Operation operation = context.GetOperation(operationDescription);
                if (operation != null)
                {
                    // We are dealing strictly with the operation here.
                    // This.Text returns the string for the operation-level attributes.
                    // Set the doc element; if this isn't done first, there is no XmlElement in the
                    // DocumentElement property.
                    operation.Documentation = String.Empty;

                    // Operation C# triple comments.
                    XmlDocument owner = operation.DocumentationElement.OwnerDocument;
                    XmlElement newSummaryElement = owner.CreateElement("summary");
                    newSummaryElement.InnerText = this.Text;
                    operation.DocumentationElement.AppendChild(newSummaryElement);

                    // Get returns information
                    ParameterInfo returnValue = operationDescription.SyncMethod.ReturnParameter;
                    object[] returnAttrs = returnValue.GetCustomAttributes(typeof(WsdlParamOrReturnDocumentationAttribute), false);
                    if (returnAttrs.Length != 0)
                    {
                        // <returns>text.</returns>
                        XmlElement returnsElement = owner.CreateElement("returns");
                        returnsElement.InnerText = ((WsdlParamOrReturnDocumentationAttribute)returnAttrs[0]).ParamComment;
                        operation.DocumentationElement.AppendChild(returnsElement);
                    }

                    // Get parameter information.
                    ParameterInfo[] args = operationDescription.SyncMethod.GetParameters();
                    for (int i = 0; i < args.Length; i++)
                    {
                        object[] docAttrs = args[i].GetCustomAttributes(typeof(WsdlParamOrReturnDocumentationAttribute), false);
                        if (docAttrs.Length == 1)
                        {
                            // <param name="Int1">Text.</param>
                            XmlElement newParamElement = owner.CreateElement("param");
                            XmlAttribute paramName = owner.CreateAttribute("name");
                            paramName.Value = args[i].Name;
                            newParamElement.InnerText = ((WsdlParamOrReturnDocumentationAttribute)docAttrs[0]).ParamComment;
                            newParamElement.Attributes.Append(paramName);
                            operation.DocumentationElement.AppendChild(newParamElement);
                        }
                    }
                }
            }
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:63,代码来源:WsdlDocumentationAttribute.cs


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