void ExportType(TypeMapping mapping) {
if (mapping.IsReference)
return;
if (ExportedMappings[mapping] == null) {
CodeTypeDeclaration codeClass = null;
ExportedMappings.Add(mapping, mapping);
if (mapping is EnumMapping) {
codeClass = ExportEnum((EnumMapping)mapping, typeof(SoapEnumAttribute));
}
else if (mapping is StructMapping) {
codeClass = ExportStruct((StructMapping)mapping);
}
else if (mapping is ArrayMapping) {
EnsureTypesExported(((ArrayMapping)mapping).Elements, null);
}
if (codeClass != null) {
// Add [GeneratedCodeAttribute(Tool=.., Version=..)]
codeClass.CustomAttributes.Add(GeneratedCodeAttribute);
// Add [SerializableAttribute]
codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(SerializableAttribute).FullName));
if (!codeClass.IsEnum) {
// Add [DebuggerStepThrough]
codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(DebuggerStepThroughAttribute).FullName));
// Add [DesignerCategory("code")]
codeClass.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(DesignerCategoryAttribute).FullName, new CodeAttributeArgument[] {new CodeAttributeArgument(new CodePrimitiveExpression("code"))}));
}
AddTypeMetadata(codeClass.CustomAttributes, typeof(SoapTypeAttribute), mapping.TypeDesc.Name, Accessor.UnescapeName(mapping.TypeName), mapping.Namespace, mapping.IncludeInSchema);
ExportedClasses.Add(mapping, codeClass);
}
}
}