Пример #1
0
        protected override object CreateBehavior()
        {
            DocumentationAttribute documentation = new DocumentationAttribute();

            documentation.Enable       = (bool)this["enable"];
            documentation.ExportAsText = (bool)this["exportAsText"];
            return(documentation);
        }
        internal static bool ExportAnnotationForMessageParameters(WsdlExporter exporter, OperationDescription operation, XmlSchemaElement elem)
        {
            bool retVal = false;

            MessageDescription md = operation.Messages.Cast <MessageDescription>().FirstOrDefault(e => e.Headers.Count == 0 && e.MessageType == null && e.Body != null && e.Body.WrapperName == elem.Name);

            if (md != null)
            {
                if (elem.ElementSchemaType != null && elem.ElementSchemaType is XmlSchemaComplexType)
                {
                    // parts
                    XmlSchemaComplexType complexType = elem.ElementSchemaType as XmlSchemaComplexType;
                    if (complexType != null && complexType.ContentTypeParticle is XmlSchemaSequence)
                    {
                        foreach (XmlSchemaElement body in (complexType.ContentTypeParticle as XmlSchemaSequence).Items)
                        {
                            DocumentationAttribute attributeBody = null;
                            if (md.Body.ReturnValue != null)
                            {
                                // ReturnValue
                                attributeBody = operation.SyncMethod.ReturnTypeCustomAttributes.GetCustomAttributes(typeof(DocumentationAttribute), false).FirstOrDefault() as DocumentationAttribute;
                                retVal        = true;
                            }
                            else
                            {
                                // part level
                                var clrPart = operation.SyncMethod.GetParameters().FirstOrDefault(e => e.Name == body.Name);
                                if (clrPart != null)
                                {
                                    attributeBody = clrPart.GetCustomAttributes(typeof(DocumentationAttribute), false).FirstOrDefault() as DocumentationAttribute;
                                }
                            }
                            if (attributeBody != null)
                            {
                                body.Annotation = CreateXmlSchemaAnnotation(attributeBody.Documentation);
                                retVal          = true;
                            }
                        }
                    }
                }
            }
            return(retVal);
        }
Пример #3
0
 public static string Load(XmlElement wsdlDocumentElement, Type clrType, DocumentationAttribute wsdlDocumentation)
 {
     if (wsdlDocumentation != null)
     {
         if (wsdlDocumentElement != null && wsdlDocumentation.ExportXmlDoc)
         {
             XElement element = Load(string.Concat("T:", clrType.FullName), clrType);
             if (element != null)
             {
                 XmlDocument doc = new XmlDocument();
                 doc.LoadXml(element.ToString());
                 foreach (XmlNode node in doc.DocumentElement.ChildNodes)
                 {
                     wsdlDocumentElement.AppendChild(wsdlDocumentElement.OwnerDocument.ImportNode(node, true));
                 }
             }
         }
         return(wsdlDocumentation.Documentation);
     }
     return(null);
 }
Пример #4
0
 public static string Load(XmlElement wsdlDocumentElement, MemberInfo memberInfo, DocumentationAttribute wsdlDocumentation)
 {
     if (wsdlDocumentation != null)
     {
         if (wsdlDocumentElement != null && wsdlDocumentation.ExportXmlDoc)
         {
             XElement element = Load(CreateMemberName(memberInfo), memberInfo.DeclaringType);
             if (element != null)
             {
                 XmlDocument doc = new XmlDocument();
                 doc.LoadXml(element.ToString());
                 foreach (XmlNode node in doc.DocumentElement.ChildNodes)
                 {
                     wsdlDocumentElement.AppendChild(wsdlDocumentElement.OwnerDocument.ImportNode(node, true));
                 }
             }
         }
         return(wsdlDocumentation.Documentation);
     }
     return(null);
 }