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,480 | 5/14/2023 |
2021.25.6.855 | 5,049 | 12/15/2021 |
2021.25.6.755 | 311 | 12/15/2021 |
2021.25.5.1355 | 3,563 | 5/26/2021 |
2021.2.9.1130 | 475 | 2/9/2021 |
2021.1.9.2000 | 742 | 1/9/2021 |
2020.12.28.1226 | 529 | 12/28/2020 |
2020.12.26.938 | 426 | 12/26/2020 |
2020.12.24.1049 | 432 | 12/24/2020 |
2020.12.24.338 | 376 | 12/24/2020 |
2020.12.12.1133 | 412 | 12/12/2020 |
2020.12.3.2000 | 385 | 12/3/2020 |
2020.11.30.939 | 410 | 11/30/2020 |
2020.11.29.12 | 380 | 11/28/2020 |
2020.11.28.2108 | 508 | 11/28/2020 |
2020.11.28.1245 | 489 | 11/28/2020 |
2020.11.28.1003 | 418 | 11/28/2020 |
2020.11.25.1356 | 353 | 11/25/2020 |
2020.11.25.701 | 425 | 11/25/2020 |
2020.11.25.632 | 450 | 11/25/2020 |
2020.11.24.2135 | 458 | 11/24/2020 |
2020.11.24.2040 | 491 | 11/24/2020 |
2020.11.23 | 410 | 11/24/2020 |