TypeMapping ImportDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, bool isList) {
TypeMapping mapping = ImportNonXsdPrimitiveDataType(dataType, typeNs);
if (mapping != null)
return mapping;
if (dataType.Content is XmlSchemaSimpleTypeRestriction) {
XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction)dataType.Content;
foreach (object o in restriction.Facets) {
if (o is XmlSchemaEnumerationFacet) {
return ImportEnumeratedDataType(dataType, typeNs, identifier, isList);
}
}
}
else if (dataType.Content is XmlSchemaSimpleTypeList || dataType.Content is XmlSchemaSimpleTypeUnion) {
if (dataType.Content is XmlSchemaSimpleTypeList) {
// check if we have enumeration list
XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList)dataType.Content;
if (list.ItemType != null) {
mapping = ImportDataType(list.ItemType, typeNs, identifier, true);
if (mapping != null) {
return mapping;
}
}
}
mapping = new PrimitiveMapping();
mapping.TypeDesc = Scope.GetTypeDesc(typeof(string));
mapping.TypeName = mapping.TypeDesc.DataType.Name;
return mapping;
}
return ImportPrimitiveDataType(dataType);
}