public override IType NormalizeTypeDeclaration(IType type) { if (type == null) { return(null); } if (type is ITypeModel) { return(type); } if (_visited.ContainsKey(type)) { return(_visited[type]); } if (type is PrimaryType) { _visited[type] = new PrimaryTypeModel(type as PrimaryType); return(_visited[type]); } if (type is SequenceType) { SequenceTypeModel model = new SequenceTypeModel(type as SequenceType); _visited[type] = model; return(NormalizeSequenceType(model)); } if (type is DictionaryType) { DictionaryTypeModel model = new DictionaryTypeModel(type as DictionaryType); _visited[type] = model; return(NormalizeDictionaryType(model)); } if (type is CompositeType) { CompositeTypeModel model = NewCompositeTypeModel(type as CompositeType); _visited[type] = model; return(NormalizeCompositeType(model)); } if (type is EnumType) { EnumTypeModel model = NewEnumTypeModel(type as EnumType); _visited[type] = model; return(NormalizeEnumType(model)); } throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Type {0} is not supported.", type.GetType())); }
public override IType NormalizeTypeReference(IType type) { if (type == null) { return(null); } if (type is ITypeModel) { return(type); } var enumType = type as EnumType; if (enumType != null && enumType.ModelAsString && enumType.Name.IsNullOrEmpty()) { type = new PrimaryTypeModel(KnownPrimaryType.String); } return(NormalizeTypeDeclaration(type)); }