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;
}
}