private XmlTypeMapping ImportClassMapping(TypeData typeData, string defaultNamespace)
{
Type type = typeData.Type;
if (type.IsValueType)
{
throw this.CreateStructException(type);
}
if (type == typeof(object))
{
defaultNamespace = "http://www.w3.org/2001/XMLSchema";
}
ReflectionHelper.CheckSerializableType(type, false);
XmlTypeMapping xmlTypeMapping = this.helper.GetRegisteredClrType(type, this.GetTypeNamespace(typeData, defaultNamespace));
if (xmlTypeMapping != null)
{
return(xmlTypeMapping);
}
xmlTypeMapping = this.CreateTypeMapping(typeData, null, defaultNamespace);
this.helper.RegisterClrType(xmlTypeMapping, type, xmlTypeMapping.Namespace);
xmlTypeMapping.MultiReferenceType = true;
ClassMap classMap = new ClassMap();
xmlTypeMapping.ObjectMap = classMap;
ICollection reflectionMembers = this.GetReflectionMembers(type);
foreach (object obj in reflectionMembers)
{
XmlReflectionMember xmlReflectionMember = (XmlReflectionMember)obj;
if (!xmlReflectionMember.SoapAttributes.SoapIgnore)
{
classMap.AddMember(this.CreateMapMember(xmlReflectionMember, defaultNamespace));
}
}
SoapIncludeAttribute[] array = (SoapIncludeAttribute[])type.GetCustomAttributes(typeof(SoapIncludeAttribute), false);
for (int i = 0; i < array.Length; i++)
{
Type type2 = array[i].Type;
this.ImportTypeMapping(type2);
}
if (type == typeof(object) && this.includedTypes != null)
{
foreach (object obj2 in this.includedTypes)
{
Type type3 = (Type)obj2;
xmlTypeMapping.DerivedTypes.Add(this.ImportTypeMapping(type3));
}
}
if (type.BaseType != null)
{
XmlTypeMapping xmlTypeMapping2 = this.ImportClassMapping(type.BaseType, defaultNamespace);
if (type.BaseType != typeof(object))
{
xmlTypeMapping.BaseMap = xmlTypeMapping2;
}
this.RegisterDerivedMap(xmlTypeMapping2, xmlTypeMapping);
}
return(xmlTypeMapping);
}