Ejemplo n.º 1
0
        } // RegisterInteropXmlType

        /// <include file='doc\Soap.uex' path='docs/doc[@for="SoapServices.PreLoad"]/*' />
        public static void PreLoad(Type type)
        {
            // register soap action values
            MethodInfo[] methods = type.GetMethods();
            foreach (MethodInfo mi in methods)
            {
                // This will only add an entry to the table if SoapAction was explicitly set
                //   on the SoapMethodAttribute.
                RegisterSoapActionForMethodBase(mi);
            }

            // register interop xml elements and types if specified
            SoapTypeAttribute attr = (SoapTypeAttribute)
                                     InternalRemotingServices.GetCachedSoapAttribute(type);

            if (attr.IsInteropXmlElement())
            {
                RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type);
            }
            if (attr.IsInteropXmlType())
            {
                RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type);
            }

            // construct field maps for mapping xml elements and attributes back to
            //   the correct type
            int mapCount          = 0;
            XmlToFieldTypeMap map = new XmlToFieldTypeMap();

            foreach (FieldInfo field in type.GetFields())
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute)
                                               InternalRemotingServices.GetCachedSoapAttribute(field);

                if (fieldAttr.IsInteropXmlElement())
                {
                    String xmlName      = fieldAttr.XmlElementName;
                    String xmlNamespace = fieldAttr.XmlNamespace;
                    if (fieldAttr.UseAttribute)
                    {
                        map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace);
                    }
                    else
                    {
                        map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace);
                    }

                    mapCount++;
                }
            } // foreach field

            // add field map if there is more than one entry
            if (mapCount > 0)
            {
                _xmlToFieldTypeMap[type] = map;
            }
        } // PreLoad
        public static void PreLoad(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (!(type is RuntimeType))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
            }
            foreach (MethodInfo info in type.GetMethods())
            {
                RegisterSoapActionForMethodBase(info);
            }
            SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);

            if (cachedSoapAttribute.IsInteropXmlElement())
            {
                RegisterInteropXmlElement(cachedSoapAttribute.XmlElementName, cachedSoapAttribute.XmlNamespace, type);
            }
            if (cachedSoapAttribute.IsInteropXmlType())
            {
                RegisterInteropXmlType(cachedSoapAttribute.XmlTypeName, cachedSoapAttribute.XmlTypeNamespace, type);
            }
            int num = 0;
            XmlToFieldTypeMap map = new XmlToFieldTypeMap();

            foreach (FieldInfo info2 in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                SoapFieldAttribute attribute2 = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute(info2);
                if (attribute2.IsInteropXmlElement())
                {
                    string xmlElementName = attribute2.XmlElementName;
                    string xmlNamespace   = attribute2.XmlNamespace;
                    if (attribute2.UseAttribute)
                    {
                        map.AddXmlAttribute(info2.FieldType, info2.Name, xmlElementName, xmlNamespace);
                    }
                    else
                    {
                        map.AddXmlElement(info2.FieldType, info2.Name, xmlElementName, xmlNamespace);
                    }
                    num++;
                }
            }
            if (num > 0)
            {
                _xmlToFieldTypeMap[type] = map;
            }
        }
 public static void PreLoad(Type type)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (!(type is RuntimeType))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
     }
     foreach (MethodInfo info in type.GetMethods())
     {
         RegisterSoapActionForMethodBase(info);
     }
     SoapTypeAttribute cachedSoapAttribute = (SoapTypeAttribute) InternalRemotingServices.GetCachedSoapAttribute(type);
     if (cachedSoapAttribute.IsInteropXmlElement())
     {
         RegisterInteropXmlElement(cachedSoapAttribute.XmlElementName, cachedSoapAttribute.XmlNamespace, type);
     }
     if (cachedSoapAttribute.IsInteropXmlType())
     {
         RegisterInteropXmlType(cachedSoapAttribute.XmlTypeName, cachedSoapAttribute.XmlTypeNamespace, type);
     }
     int num = 0;
     XmlToFieldTypeMap map = new XmlToFieldTypeMap();
     foreach (FieldInfo info2 in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
     {
         SoapFieldAttribute attribute2 = (SoapFieldAttribute) InternalRemotingServices.GetCachedSoapAttribute(info2);
         if (attribute2.IsInteropXmlElement())
         {
             string xmlElementName = attribute2.XmlElementName;
             string xmlNamespace = attribute2.XmlNamespace;
             if (attribute2.UseAttribute)
             {
                 map.AddXmlAttribute(info2.FieldType, info2.Name, xmlElementName, xmlNamespace);
             }
             else
             {
                 map.AddXmlElement(info2.FieldType, info2.Name, xmlElementName, xmlNamespace);
             }
             num++;
         }
     }
     if (num > 0)
     {
         _xmlToFieldTypeMap[type] = map;
     }
 }
Ejemplo n.º 4
0
        } // RegisterInteropXmlType


        /// <include file='doc\Soap.uex' path='docs/doc[@for="SoapServices.PreLoad"]/*' />
        public static void PreLoad(Type type)
        {
            // register soap action values
                MethodInfo[] methods = type.GetMethods();
                foreach (MethodInfo mi in methods)
                {
                    // This will only add an entry to the table if SoapAction was explicitly set
                    //   on the SoapMethodAttribute.
                    RegisterSoapActionForMethodBase(mi);
                }

            // register interop xml elements and types if specified
            SoapTypeAttribute attr = (SoapTypeAttribute)
                InternalRemotingServices.GetCachedSoapAttribute(type);

            if (attr.IsInteropXmlElement())            
                RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type);
            if (attr.IsInteropXmlType())
                RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type);

            // construct field maps for mapping xml elements and attributes back to
            //   the correct type            
            int mapCount = 0;
            XmlToFieldTypeMap map = new XmlToFieldTypeMap();
            
            foreach(FieldInfo field in type.GetFields())
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute)
                    InternalRemotingServices.GetCachedSoapAttribute(field);
            
                if (fieldAttr.IsInteropXmlElement())
                {
                    String xmlName = fieldAttr.XmlElementName;
                    String xmlNamespace = fieldAttr.XmlNamespace;
                    if (fieldAttr.UseAttribute)
                        map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace);
                    else
                        map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace);
                        
                    mapCount++;
                }
            } // foreach field

            // add field map if there is more than one entry
            if (mapCount > 0)
                _xmlToFieldTypeMap[type] = map;
                
        } // PreLoad
Ejemplo n.º 5
0
        [System.Security.SecurityCritical]  // auto-generated
        public static void PreLoad(Type type) 
        { 
            if (type == null)
                throw new ArgumentNullException("type"); 
            Contract.EndContractBlock();

            if (!(type is RuntimeType))
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType")); 

            // register soap action values 
            MethodInfo[] methods = type.GetMethods(); 
            foreach (MethodInfo mi in methods)
            { 
                // This will only add an entry to the table if SoapAction was explicitly set
                //   on the SoapMethodAttribute.
                RegisterSoapActionForMethodBase(mi);
            } 

            // register interop xml elements and types if specified 
            SoapTypeAttribute attr = (SoapTypeAttribute) 
                InternalRemotingServices.GetCachedSoapAttribute(type);
 
            if (attr.IsInteropXmlElement())
                RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type);
            if (attr.IsInteropXmlType())
                RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type); 

            // construct field maps for mapping xml elements and attributes back to 
            //   the correct type 
            int mapCount = 0;
            XmlToFieldTypeMap map = new XmlToFieldTypeMap(); 

            foreach (FieldInfo field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute) 
                    InternalRemotingServices.GetCachedSoapAttribute(field);
 
                if (fieldAttr.IsInteropXmlElement()) 
                {
                    String xmlName = fieldAttr.XmlElementName; 
                    String xmlNamespace = fieldAttr.XmlNamespace;
                    if (fieldAttr.UseAttribute)
                        map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace);
                    else 
                        map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace);
 
                    mapCount++; 
                }
            } // foreach field 

            // add field map if there is more than one entry
            if (mapCount > 0)
                _xmlToFieldTypeMap[type] = map; 

        } // PreLoad 
Ejemplo n.º 6
0
        [System.Security.SecurityCritical]  // auto-generated
        public static void PreLoad(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            Contract.EndContractBlock();

            if (!(type is RuntimeType))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
            }

            // register soap action values
            MethodInfo[] methods = type.GetMethods();
            foreach (MethodInfo mi in methods)
            {
                // This will only add an entry to the table if SoapAction was explicitly set
                //   on the SoapMethodAttribute.
                RegisterSoapActionForMethodBase(mi);
            }

            // register interop xml elements and types if specified
            SoapTypeAttribute attr = (SoapTypeAttribute)
                                     InternalRemotingServices.GetCachedSoapAttribute(type);

            if (attr.IsInteropXmlElement())
            {
                RegisterInteropXmlElement(attr.XmlElementName, attr.XmlNamespace, type);
            }
            if (attr.IsInteropXmlType())
            {
                RegisterInteropXmlType(attr.XmlTypeName, attr.XmlTypeNamespace, type);
            }

            // construct field maps for mapping xml elements and attributes back to
            //   the correct type
            int mapCount          = 0;
            XmlToFieldTypeMap map = new XmlToFieldTypeMap();

            foreach (FieldInfo field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                SoapFieldAttribute fieldAttr = (SoapFieldAttribute)
                                               InternalRemotingServices.GetCachedSoapAttribute(field);

                if (fieldAttr.IsInteropXmlElement())
                {
                    String xmlName      = fieldAttr.XmlElementName;
                    String xmlNamespace = fieldAttr.XmlNamespace;
                    if (fieldAttr.UseAttribute)
                    {
                        map.AddXmlAttribute(field.FieldType, field.Name, xmlName, xmlNamespace);
                    }
                    else
                    {
                        map.AddXmlElement(field.FieldType, field.Name, xmlName, xmlNamespace);
                    }

                    mapCount++;
                }
            } // foreach field

            // add field map if there is more than one entry
            if (mapCount > 0)
            {
                _xmlToFieldTypeMap[type] = map;
            }
        } // PreLoad