private CodeTypeDeclaration ProcessType(ClrContentTypeInfo typeInfo, string parentIdentifier, bool globalType) { SetFullTypeName(typeInfo, parentIdentifier); if (globalType) { currentNamespace = typeInfo.clrtypeNs; } //Build type using TypeBuilder typeBuilder = GetTypeBuilder(); typeBuilder.CreateTypeDeclaration(typeInfo); ProcessProperties(typeInfo.Content, typeInfo.Annotations); typeBuilder.CreateFunctionalConstructor(typeInfo.Annotations); typeBuilder.ImplementInterfaces(settings.EnableServiceReference); typeBuilder.ApplyAnnotations(typeInfo); if (globalType) { if (typeInfo.typeOrigin == SchemaOrigin.Fragment) { typeBuilder.AddTypeToTypeManager(typeDictionaryAddStatements, Constants.TypeDictionaryField); } else { typeBuilder.AddTypeToTypeManager(elementDictionaryAddStatements, Constants.ElementDictionaryField); } } CodeTypeDeclaration builtType = typeBuilder.TypeDeclaration; ProcessNestedTypes(typeInfo.NestedTypes, builtType, typeInfo.clrFullTypeName); return(builtType); }
private CodeTypeDeclaration ProcessType(ClrContentTypeInfo typeInfo, string parentIdentifier, bool globalType) { SetFullTypeName(typeInfo, parentIdentifier); if(globalType) { currentNamespace = typeInfo.clrtypeNs; } //Build type using TypeBuilder typeBuilder = GetTypeBuilder(); typeBuilder.CreateTypeDeclaration(typeInfo); ProcessProperties(typeInfo.Content, typeInfo.Annotations); typeBuilder.CreateFunctionalConstructor(typeInfo.Annotations); typeBuilder.ImplementInterfaces(settings.EnableServiceReference); typeBuilder.ApplyAnnotations(typeInfo); if (globalType) { if (typeInfo.typeOrigin == SchemaOrigin.Fragment) { typeBuilder.AddTypeToTypeManager(typeDictionaryAddStatements, Constants.TypeDictionaryField); } else { typeBuilder.AddTypeToTypeManager(elementDictionaryAddStatements, Constants.ElementDictionaryField); } } CodeTypeDeclaration builtType = typeBuilder.TypeDeclaration; ProcessNestedTypes(typeInfo.NestedTypes, builtType, typeInfo.clrFullTypeName); return builtType; }