SkinnyControllersGenerator 2023.5.14.2055

dotnet add package SkinnyControllersGenerator --version 2023.5.14.2055
NuGet\Install-Package SkinnyControllersGenerator -Version 2023.5.14.2055
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SkinnyControllersGenerator" Version="2023.5.14.2055" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SkinnyControllersGenerator --version 2023.5.14.2055
#r "nuget: SkinnyControllersGenerator, 2023.5.14.2055"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

  1. All Post
  2. Get - if not arguments, POST else
  3. Rest action

You can add your template in 2 ways: //if custom template , hte name must end in controller.txt

  1. [AutoActions(template = TemplateIndicator.CustomTemplateFile, FieldsName = new[] { "*" } ,CustomTemplateFileName = "Controllers\CustomTemplate1.controller.txt")]

  2. For creating new generic templates, please PR to https://github.com/ignatandrei/SkinnyControllersGenerator

That's all!

Usual problems:

  1. error CS0260: Missing partial modifier on declaration of type

Answer:

Did you put partial on the controller declaration ?

public partial class

There are no supported framework assets in this package.

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 978 5/14/2023
2021.25.6.855 4,486 12/15/2021
2021.25.6.755 284 12/15/2021
2021.25.5.1355 3,529 5/26/2021
2021.2.9.1130 446 2/9/2021
2021.1.9.2000 712 1/9/2021
2020.12.28.1226 494 12/28/2020
2020.12.26.938 398 12/26/2020
2020.12.24.1049 402 12/24/2020
2020.12.24.338 349 12/24/2020
2020.12.12.1133 383 12/12/2020
2020.12.3.2000 358 12/3/2020
2020.11.30.939 382 11/30/2020
2020.11.29.12 348 11/28/2020
2020.11.28.2108 481 11/28/2020
2020.11.28.1245 459 11/28/2020
2020.11.28.1003 393 11/28/2020
2020.11.25.1356 323 11/25/2020
2020.11.25.701 390 11/25/2020
2020.11.25.632 422 11/25/2020
2020.11.24.2135 414 11/24/2020
2020.11.24.2040 463 11/24/2020
2020.11.23 379 11/24/2020