Example #1
0
        public ApiProjectModel ScaffoldModel(OpenApiOptions options)
        {
            ApiProjectModel model = new ApiProjectModel
            {
                ProjectFile =
                    CreateFile(Generator.WriteProjectFile(options),
                               Path.Combine(options.ApiProjectDir, options.ApiProjectName + ".csproj")),
                StartupCSFile =
                    CreateFile(Generator.WriteStartupCSFile(options),
                               Path.Combine(options.ApiProjectDir, "Startup.cs")),
                ProgramCSFile =
                    CreateFile(Generator.WriteProgramCSFile(options),
                               Path.Combine(options.ApiProjectDir, "Program.cs")),
                ServicesConfigurationCSFile =
                    CreateFile(Generator.WriteServicesConfigurationCSFile(options),
                               Path.Combine(options.ApiProjectDir, "ServicesConfiguration.cs")),
                AppSettingsDevelopmentJSONFile =
                    CreateFile(Generator.WriteAppSettingsDevelopmentJSONFile(options),
                               Path.Combine(options.ApiProjectDir, "appsettings.Development.json")),
                AppSettingsJSONFile =
                    CreateFile(Generator.WriteAppSettingsJSONFile(options),
                               Path.Combine(options.ApiProjectDir, "appsettings.json"))
            };

            model.Controllers = ControllerScaffolder.ScaffoldModel(options).Files;
            return(model);
        }
Example #2
0
 public void Save(ApiProjectModel model)
 {
     Dependencies.FileWriter.WriteFile(model.ProjectFile);
     Dependencies.FileWriter.WriteFile(model.ProgramCSFile);
     Dependencies.FileWriter.WriteFile(model.StartupCSFile);
     Dependencies.FileWriter.WriteFile(model.AppSettingsJSONFile);
     Dependencies.FileWriter.WriteFile(model.AppSettingsDevelopmentJSONFile);
     Dependencies.FileWriter.WriteFile(model.ServicesConfigurationCSFile);
     Dependencies.FileWriter.WriteFiles(model.Controllers);
 }