Example #1
0
        public override async Task <(string outputLocation, Dictionary <string, string> outputValues, string errorMessage)> Generate()
        {
            AdditionalConfigs.TryGetValue("AdminEmail", out var adminEmail);

            Config.OutputLocation = Config.OutputLocation ?? Config.WorkingLocation;

            var generator = new CodeGenerator(ProjectName, Config.OutputLocation, Models, adminEmail, Logger);

            await generator.InitSolution();

            await generator.InitProjects();

            await generator.GenerateModels();

            await generator.GenerateDbContext();

            await generator.GenerateRepositories();

            await generator.GenerateServices();

            await generator.GenerateControllers();

            await generator.GenerateViews();

            await generator.UpdateMigrationScript();

            await generator.GenerateRepositoryFiles();

            return(Config.OutputLocation, null, "");
        }
Example #2
0
        public override async Task <(string outputLocation, Dictionary <string, string> outputValues, string errorMessage)> Generate()
        {
            var installedSdk = await CommandHelper.RunDotnet("--list-sdks");

            if (string.IsNullOrWhiteSpace(installedSdk) || !installedSdk.Contains("2.2."))
            {
                return(null, null, $"Task Provider {TaskProviderName} require minimum dotnet sdk 2.2 to be installed");
            }

            AdditionalConfigs.TryGetValue("AdminEmail", out var adminEmail);

            Config.OutputLocation = Config.OutputLocation ?? Config.WorkingLocation;

            var generator = new CodeGenerator(ProjectName, Config.OutputLocation, Models, adminEmail, Logger);

            await generator.InitSolution();

            await generator.InitProjects();

            await generator.GenerateModels();

            await generator.GenerateDbContext();

            await generator.GenerateRepositories();

            await generator.GenerateServices();

            await generator.GenerateControllers();

            await generator.GenerateViews();

            await generator.UpdateMigrationScript();

            await generator.GenerateRepositoryFiles();

            return(Config.OutputLocation, null, "");
        }