internal void ExportRoot(StructMapping mapping, Type includeType) {
if (!rootExported) {
rootExported = true;
ExportDerivedStructs(mapping);
for (StructMapping derived = mapping.DerivedMappings; derived != null; derived = derived.NextDerivedMapping) {
if (!derived.ReferencedByElement && derived.IncludeInSchema && !derived.IsAnonymousType) {
CodeAttributeDeclaration include = new CodeAttributeDeclaration(includeType.FullName);
include.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(derived.TypeDesc.FullName)));
includeMetadata.Add(include);
}
}
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)) {
CodeAttributeDeclaration include = new CodeAttributeDeclaration(includeType.FullName);
include.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(arrayMapping.TypeDesc.FullName)));
includeMetadata.Add(include);
typesIncluded.Add(arrayMapping.TypeDesc.FullName, string.Empty);
EnsureTypesExported(arrayMapping.Elements, arrayMapping.Namespace);
}
}
}
}
}