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


C# Binding.GetDocumentationElement方法代码示例

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


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

示例1: ReflectBinding

        void ReflectBinding(ReflectedBinding reflectedBinding) {
            string bindingName = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string bindingNamespace = reflectedBinding.bindingAttr.Namespace;
            if (bindingName.Length == 0) bindingName = Service.Name + ProtocolName;
            if (bindingNamespace.Length == 0) bindingNamespace = ServiceDescription.TargetNamespace;
            WsiProfiles claims = WsiProfiles.None;
            
            if (reflectedBinding.bindingAttr.Location.Length > 0) {
                // If a URL is specified for the WSDL, file, then we just import the
                // binding from there instead of generating it in this WSDL file.
                portType = null;
                binding = null;
            }
            else {
                bindingServiceDescription = GetServiceDescription(bindingNamespace);
                CodeIdentifiers bindingNames = new CodeIdentifiers();
                foreach (Binding b in bindingServiceDescription.Bindings)
                    bindingNames.AddReserved(b.Name);

                bindingName = bindingNames.AddUnique(bindingName, binding);

                portType = new PortType();
                binding = new Binding();
                portType.Name = bindingName;
                binding.Name = bindingName;
                binding.Type = new XmlQualifiedName(portType.Name, bindingNamespace);
                claims = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && claims != WsiProfiles.None) {
                    ServiceDescription.AddConformanceClaims(binding.GetDocumentationElement(), claims);
                }
                bindingServiceDescription.Bindings.Add(binding);
                bindingServiceDescription.PortTypes.Add(portType);
            }
            
            if (portNames == null) {
                portNames = new CodeIdentifiers();
                foreach (Port p in Service.Ports)
                    portNames.AddReserved(p.Name);
            }

            port = new Port();
            port.Binding = new XmlQualifiedName(bindingName, bindingNamespace);
            port.Name = portNames.AddUnique(bindingName, port);
            Service.Ports.Add(port);
            
            BeginClass();

            if (reflectedBinding.methodList != null && reflectedBinding.methodList.Count > 0) {
                foreach (LogicalMethodInfo method in reflectedBinding.methodList) {

                    MoveToMethod(method);

                    operation = new Operation();
                    operation.Name = XmlConvert.EncodeLocalName(method.Name);
                    if (methodAttr.Description != null && methodAttr.Description.Length > 0)
                        operation.Documentation = methodAttr.Description;

                    operationBinding = new OperationBinding();
                    operationBinding.Name = operation.Name;

                    inputMessage = null;
                    outputMessage = null;
                    headerMessages = null;

                    if (ReflectMethod()) {
                        if (inputMessage != null) bindingServiceDescription.Messages.Add(inputMessage);
                        if (outputMessage != null) bindingServiceDescription.Messages.Add(outputMessage);
                        if (headerMessages != null) {
                            foreach (Message headerMessage in headerMessages) {
                                bindingServiceDescription.Messages.Add(headerMessage);
                            }
                        }
                        binding.Operations.Add(operationBinding);
                        portType.Operations.Add(operation);
                    }
                }
            }
            if (binding != null && claims == WsiProfiles.BasicProfile1_1 && ProtocolName == "Soap") {
                BasicProfileViolationCollection warnings = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(binding, bindingServiceDescription, ServiceDescriptions, warnings);
                if (warnings.Count > 0) {
                    throw new InvalidOperationException(Res.GetString(Res.WebWsiViolation, ServiceType.FullName, warnings.ToString()));
                }
            }
            EndClass();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:86,代码来源:ProtocolReflector.cs


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