RegisterSoapActionForMethodBase() public static méthode

public static RegisterSoapActionForMethodBase ( MethodBase mb ) : void
mb System.Reflection.MethodBase
Résultat void
Exemple #1
0
        public static void RegisterSoapActionForMethodBase(MethodBase mb)
        {
            SoapMethodAttribute soapMethodAttribute = (SoapMethodAttribute)InternalRemotingServices.GetCachedSoapAttribute(mb);

            if (soapMethodAttribute.SoapActionExplicitySet)
            {
                SoapServices.RegisterSoapActionForMethodBase(mb, soapMethodAttribute.SoapAction);
            }
        }
Exemple #2
0
        public static void PreLoad(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (!(type is RuntimeType))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
            }
            MethodInfo[] methods = type.GetMethods();
            foreach (MethodInfo mb in methods)
            {
                SoapServices.RegisterSoapActionForMethodBase(mb);
            }
            SoapTypeAttribute soapTypeAttribute = (SoapTypeAttribute)InternalRemotingServices.GetCachedSoapAttribute(type);

            if (soapTypeAttribute.IsInteropXmlElement())
            {
                SoapServices.RegisterInteropXmlElement(soapTypeAttribute.XmlElementName, soapTypeAttribute.XmlNamespace, type);
            }
            if (soapTypeAttribute.IsInteropXmlType())
            {
                SoapServices.RegisterInteropXmlType(soapTypeAttribute.XmlTypeName, soapTypeAttribute.XmlTypeNamespace, type);
            }
            int num = 0;

            SoapServices.XmlToFieldTypeMap xmlToFieldTypeMap = new SoapServices.XmlToFieldTypeMap();
            foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
            {
                SoapFieldAttribute soapFieldAttribute = (SoapFieldAttribute)InternalRemotingServices.GetCachedSoapAttribute(fieldInfo);
                if (soapFieldAttribute.IsInteropXmlElement())
                {
                    string xmlElementName = soapFieldAttribute.XmlElementName;
                    string xmlNamespace   = soapFieldAttribute.XmlNamespace;
                    if (soapFieldAttribute.UseAttribute)
                    {
                        xmlToFieldTypeMap.AddXmlAttribute(fieldInfo.FieldType, fieldInfo.Name, xmlElementName, xmlNamespace);
                    }
                    else
                    {
                        xmlToFieldTypeMap.AddXmlElement(fieldInfo.FieldType, fieldInfo.Name, xmlElementName, xmlNamespace);
                    }
                    num++;
                }
            }
            if (num > 0)
            {
                SoapServices._xmlToFieldTypeMap[type] = xmlToFieldTypeMap;
            }
        }