public async Task Output(AppApiTemplate appTemplate) { foreach (var group in appTemplate.GroupTemplates) { var controller = createController(appTemplate, group); var controllerClassName = getControllerClassName(group); var cSharpFile = new CSharpFile(controller, createStream, controllerClassName); await cSharpFile.Output(); } var namespaces = appTemplate.ObjectTemplates(ApiCodeGenerators.Dotnet) .Select(o => o.DataType.Namespace ?? "") .Union ( new[] { "Microsoft.AspNetCore.Authorization", "Microsoft.AspNetCore.Mvc", "XTI_App.Api", "XTI_WebApp.Api" } ) .Distinct() .OrderBy(str => str) .ToArray(); await new GlobalUsingsClass(createStream, namespaces).Output(); }
public async Task Output() { var usings = new List <UsingDirectiveSyntax>(); var firstNS = namespaces[0]; usings.Add ( UsingDirective(IdentifierName(firstNS)) .WithGlobalKeyword ( Token ( TriviaList(Comment("// Generated Code")), SyntaxKind.GlobalKeyword, TriviaList() ) ) ); foreach (var ns in namespaces.Skip(1)) { usings.Add ( UsingDirective(IdentifierName(ns)) .WithGlobalKeyword(Token(SyntaxKind.GlobalKeyword)) ); } var code = CompilationUnit() .WithUsings ( List(usings) ); var cSharpFile = new CSharpFile(code, createStream, "DefaultGlobalUsings"); await cSharpFile.Output(); }
private Task outputClass(CompilationUnitSyntax compilationUnitSyntax, string className) { var cSharpFile = new CSharpFile(compilationUnitSyntax, createStream, className); return(cSharpFile.Output()); }
private async Task outputClass(CompilationUnitSyntax compilationUnitSyntax, string className) { var cSharpFile = new CSharpFile(compilationUnitSyntax, createStream, className); await cSharpFile.Output(); }