void ExportRoot(StructMapping mapping)
{
if (!rootExported)
{
rootExported = true;
ExportDerivedStructs(mapping);
for (StructMapping derived = mapping.DerivedMappings; derived != null; derived = derived.NextDerivedMapping)
{
if (!derived.ReferencedByElement)
{
string fullTypeName = CodeIdentifier.EscapeKeywords(derived.TypeDesc.FullName);
CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { new CodeAttributeArgument(new CodeTypeOfExpression(fullTypeName)) };
AddCustomAttribute(includeMetadata, typeof(XmlIncludeAttribute), arguments);
}
}
Hashtable typesIncluded = new Hashtable();
foreach (TypeMapping m in scope.TypeMappings)
{
if (m is ArrayMapping)
{
ArrayMapping arrayMapping = (ArrayMapping)m;
if (ShouldInclude(arrayMapping) && !typesIncluded.Contains(arrayMapping.TypeDesc.FullName))
{
string fullTypeName = CodeIdentifier.EscapeKeywords(arrayMapping.TypeDesc.FullName);
CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { new CodeAttributeArgument(new CodeTypeOfExpression(fullTypeName)) };
AddCustomAttribute(includeMetadata, typeof(XmlIncludeAttribute), arguments);
typesIncluded.Add(arrayMapping.TypeDesc.FullName, "");
}
}
}
}
}