private CompilationUnitSyntax GetSyntax(JSchema schema) { var typeContext = new Dictionary <string, MemberDeclarationSyntax>(); RoslynExtension.GenerateClass(schema, typeContext, string.Empty, _namingRule); var root = Syntax.CompilationUnit() .WithMembers(Syntax.NamespaceDeclaration(Syntax.ParseName(_namingRule.GetNamespaceName(schema))).WithMembers(Syntax.List(typeContext.Values.ToArray()))); return(root); }
public async Task <Type> GetModelTypeFromTemplateAsync(TemplateInfo templateInfo) { var schema = await _schemaProvider.GetSchemaFromTemplateAsync(templateInfo).ConfigureAwait(false); var typeName = string.Format("{0}.{1}.{2},{3}", _rootNamespace, _namingRule.GetNamespaceName(schema), _namingRule.GetClassName(schema, string.Empty), _assemblyName); try { return(Type.GetType(typeName, true)); } catch (TypeLoadException) { return(null); } }