コード例 #1
0
		public void TestConstructors ()
		{
			WebServiceAttribute attribute;

			attribute = new WebServiceAttribute ();
			AssertEquals (String.Empty, attribute.Description);
			AssertEquals (String.Empty, attribute.Name);
			AssertEquals ("http://tempuri.org/", attribute.Namespace);
		}
 public void Reflect(Type type, string url)
 {
     this.serviceType = type;
     this.serviceUrl = url;
     this.serviceAttr = WebServiceReflector.GetAttribute(type);
     this.methods = WebMethodReflector.GetMethods(type);
     this.CheckForDuplicateMethods(this.methods);
     this.descriptionsWithPost = this.descriptions;
     this.schemasWithPost = this.schemas;
     if (this.reflectorsWithPost != null)
     {
         this.ReflectInternal(this.reflectorsWithPost);
         this.descriptions = new ServiceDescriptionCollection();
         this.schemas = new XmlSchemas();
     }
     this.ReflectInternal(this.reflectors);
     if ((this.serviceAttr.Description != null) && (this.serviceAttr.Description.Length > 0))
     {
         this.ServiceDescription.Documentation = this.serviceAttr.Description;
     }
     this.ServiceDescription.Types.Schemas.Compile(null, false);
     if (this.ServiceDescriptions.Count > 1)
     {
         this.Schemas.Add(this.ServiceDescription.Types.Schemas);
         this.ServiceDescription.Types.Schemas.Clear();
     }
     else if (this.ServiceDescription.Types.Schemas.Count > 0)
     {
         XmlSchema[] array = new XmlSchema[this.ServiceDescription.Types.Schemas.Count];
         this.ServiceDescription.Types.Schemas.CopyTo(array, 0);
         foreach (XmlSchema schema in array)
         {
             if (XmlSchemas.IsDataSet(schema))
             {
                 this.ServiceDescription.Types.Schemas.Remove(schema);
                 this.Schemas.Add(schema);
             }
         }
     }
 }
コード例 #3
0
        /// <include file='doc\ServiceDescriptionReflector.uex' path='docs/doc[@for="ServiceDescriptionReflector.Reflect"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void Reflect(Type type, string url) {
            serviceType = type;
            serviceUrl = url;
            
            serviceAttr = WebServiceReflector.GetAttribute(type);

            methods = WebMethodReflector.GetMethods(type);
            CheckForDuplicateMethods(methods);

            descriptionsWithPost = descriptions;
            schemasWithPost = schemas;

            if (reflectorsWithPost != null) {
                ReflectInternal(reflectorsWithPost);

                descriptions = new ServiceDescriptionCollection();
                schemas = new XmlSchemas();
            }
            
            ReflectInternal(reflectors);

            if (serviceAttr.Description != null && serviceAttr.Description.Length > 0)
                ServiceDescription.Documentation = serviceAttr.Description;

            // need to preprocess all exported schemas to make sure that IXmlSerializable schemas are Merged and the resulting set is valid
            ServiceDescription.Types.Schemas.Compile(null, false);

            if (ServiceDescriptions.Count > 1) {
                // if defining interfaces, we move all schemas to the external collection
                // since the types therein may be referenced from any of the sdls
                Schemas.Add(ServiceDescription.Types.Schemas);
                ServiceDescription.Types.Schemas.Clear();
            }
            else if (ServiceDescription.Types.Schemas.Count > 0) {
                XmlSchema[] descriptionSchemas = new XmlSchema[ServiceDescription.Types.Schemas.Count];
                ServiceDescription.Types.Schemas.CopyTo(descriptionSchemas, 0);
                foreach (XmlSchema schema in descriptionSchemas) {
                    // we always move dataset schemas to the external schema's collection.
                    if (XmlSchemas.IsDataSet(schema)) {
                        ServiceDescription.Types.Schemas.Remove(schema);
                        Schemas.Add(schema);
                    }
                }
            }
        }