SkinnyControllersGenerator 2023.5.14.2055
dotnet add package SkinnyControllersGenerator --version 2023.5.14.2055
NuGet\Install-Package SkinnyControllersGenerator -Version 2023.5.14.2055
<PackageReference Include="SkinnyControllersGenerator" Version="2023.5.14.2055" />
paket add SkinnyControllersGenerator --version 2023.5.14.2055
#r "nuget: SkinnyControllersGenerator, 2023.5.14.2055"
// Install SkinnyControllersGenerator as a Cake Addin #addin nuget:?package=SkinnyControllersGenerator&version=2023.5.14.2055 // Install SkinnyControllersGenerator as a Cake Tool #tool nuget:?package=SkinnyControllersGenerator&version=2023.5.14.2055
SkinnyControllersGenerator
SkinnyControllers generates controller action for each field of your controller
How to install SkinnyControllers in a .NET Core 5 WebAPI / MVC application Step 1:
Install https://www.nuget.org/packages/SkinnyControllersGenerator/
Step 2:
Install https://www.nuget.org/packages/SkinnyControllersCommon/
Step 3:
Add a field to your action either via DI, either directly
[ApiController]
[Route("[controller]/[action]")]
public partial class WeatherForecastController : ControllerBase
{
private readonly RepositoryWF repository;
public WeatherForecastController(RepositoryWF repository)
{
this.repository = repository;
//or make
//this.repository=new RepositoryWF();
}
Step 4:
Add partial declaration and decorate your controller with
[AutoActions(template = TemplateIndicator.AllPost,FieldsName =new[] { "*" }, ExcludeFields =new[]{"_logger"})]
[ApiController]
[Route("[controller]/[action]")]
public partial class WeatherForecastController : ControllerBase
You can choose your template from
- All Post
- Get - if not arguments, POST else
- Rest action
You can add your template in 2 ways: //if custom template , hte name must end in controller.txt
[AutoActions(template = TemplateIndicator.CustomTemplateFile, FieldsName = new[] { "*" } ,CustomTemplateFileName = "Controllers\CustomTemplate1.controller.txt")]
For creating new generic templates, please PR to https://github.com/ignatandrei/SkinnyControllersGenerator
That's all!
Usual problems:
- error CS0260: Missing partial modifier on declaration of type
Answer:
Did you put partial on the controller declaration ?
public partial class
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SkinnyControllersGenerator:
Package | Downloads |
---|---|
SkinnyControllersCommon
Autogenerates actions to a controller from a class . ( replace below single quotes with double quotes) [AutoActions(template = TemplateIndicator.AllPost,FieldsName =new[] { '*' }, ExcludeFields =new[]{'_logger'})] [ApiController] [Route('[controller]/[action]')] public partial class WeatherForecastController : ControllerBase{ // it will generate for this field private readonly RepositoryWF repository; Add also Nuget package SkinnyControllersGenerator You can have your own template - read the readme.txt |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2023.5.14.2055 | 5,631 | 5/14/2023 |
2021.25.6.855 | 5,069 | 12/15/2021 |
2021.25.6.755 | 313 | 12/15/2021 |
2021.25.5.1355 | 3,565 | 5/26/2021 |
2021.2.9.1130 | 477 | 2/9/2021 |
2021.1.9.2000 | 744 | 1/9/2021 |
2020.12.28.1226 | 531 | 12/28/2020 |
2020.12.26.938 | 428 | 12/26/2020 |
2020.12.24.1049 | 434 | 12/24/2020 |
2020.12.24.338 | 378 | 12/24/2020 |
2020.12.12.1133 | 414 | 12/12/2020 |
2020.12.3.2000 | 387 | 12/3/2020 |
2020.11.30.939 | 414 | 11/30/2020 |
2020.11.29.12 | 382 | 11/28/2020 |
2020.11.28.2108 | 510 | 11/28/2020 |
2020.11.28.1245 | 491 | 11/28/2020 |
2020.11.28.1003 | 420 | 11/28/2020 |
2020.11.25.1356 | 355 | 11/25/2020 |
2020.11.25.701 | 427 | 11/25/2020 |
2020.11.25.632 | 452 | 11/25/2020 |
2020.11.24.2135 | 460 | 11/24/2020 |
2020.11.24.2040 | 493 | 11/24/2020 |
2020.11.23 | 412 | 11/24/2020 |