dotnet aspnet-codegenerator controller

dotnet aspnet-codegenerator controller --help

eg@debian:/media/eg/data/DotnetCliExamples/ExampleSolution/ExampleSolution.Mvc1$ dotnet aspnet-codegenerator controller --help


Usage: aspnet-codegenerator [arguments] [options]

Arguments:
  generator  Name of the generator. Check available generators below.

Options:
  -p|--project             Path to .csproj file in the project.
  -n|--nuget-package-dir   
  -c|--configuration       Configuration for the project (Possible values: Debug/ Release)
  -tfm|--target-framework  Target Framework to use. (Short folder name of the tfm. eg. net46)
  -b|--build-base-path     
  --no-build               

Selected Code Generator: controller

Generator Options:
  --controllerName|-name              : Name of the controller
  --useAsyncActions|-async            : Switch to indicate whether to generate async controller actions
  --noViews|-nv                       : Switch to indicate whether to generate CRUD views
  --restWithNoViews|-api              : Specify this switch to generate a Controller with REST style API, noViews is assumed and any view related options are ignored
  --readWriteActions|-actions         : Specify this switch to generate Controller with read/write actions when a Model class is not used
  --model|-m                          : Model class to use
  --dataContext|-dc                   : DbContext class to use
  --referenceScriptLibraries|-scripts : Switch to specify whether to reference script libraries in the generated views
  --layout|-l                         : Custom Layout page to use
  --useDefaultLayout|-udl             : Switch to specify that default layout should be used for the views
  --force|-f                          : Use this option to overwrite existing files
  --relativeFolderPath|-outDir        : Specify the relative output folder path from project where the file needs to be generated, if not specified, file will be generated in the project folder
  --controllerNamespace|-namespace    : Specify the name of the namespace to use for the generated controller
  --databaseProvider|-dbProvider      : Database provider to use. Options include 'sqlserver' (default), 'sqlite', 'cosmos', 'postgres'.
  --useSqLite|-sqlite                 : Flag to specify if DbContext should use SQLite instead of SQL Server.


RunTime 00:00:00.97

dotnet aspnet-codegenerator controller --controllerName <controller_name> --controllerNamespace <namespace_name> --relativeFolderPath <controller_folder_name>

eg@debian:/media/eg/data/DotnetCliExamples/ExampleSolution/ExampleSolution.Mvc1$ dotnet aspnet-codegenerator controller --controllerName LoginController --controllerNamespace ExampleSolution.Mvc1.Controllers --relativeFolderPath Controllers
Building project ...
Finding the generator 'controller'...
Running the generator 'controller'...
Added Controller : '/Controllers/LoginController.cs'.
RunTime 00:00:03.43

Last updated