Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

.NET API Scaffold

Generate a full ASP.NET Core API resource — controller, service, and repository with CRUD operations — from a single command.

Features

  • One command generates the controller, service, and repository (plus interfaces when requested) for a given model.
  • Basic CRUD operations: GetAll, GetById, Create, Update, Delete.
  • Repository methods are generated as NotImplementedException stubs for the developer to fill in with the real data access.
  • Detects an existing model class; if the model is missing, it signals you and offers to create a stub.
  • Auto-detects the root namespace from the .csproj and places files in conventional folders.
  • Optional dependency-injection registration in Program.cs.

Usage

  1. Open a .NET API project folder in VS Code.
  2. Run the command ".NET API Scaffold: Generate Resource" from the Command Palette (Cmd+Shift+P) or the Explorer context menu.
  3. Choose With interfaces or Without interfaces.
  4. Enter the model name (e.g. Product).
  5. If the model doesn't exist, confirm creating a stub model.
  6. Optionally confirm registering the generated services in Program.cs.

Generated structure

For a Product model with interfaces enabled:

Controllers/ProductsController.cs
Services/IProductService.cs
Services/ProductService.cs
Repositories/IProductRepository.cs
Repositories/ProductRepository.cs
Models/Product.cs            (only if the model did not already exist)

Configuration

Setting Default Description
dotnetApiScaffold.folders.controllers Controllers Folder for controllers
dotnetApiScaffold.folders.services Services Folder for services
dotnetApiScaffold.folders.repositories Repositories Folder for repositories
dotnetApiScaffold.folders.models Models Folder for models
dotnetApiScaffold.defaultWithInterfaces true Default answer for the interfaces prompt
dotnetApiScaffold.rootNamespace "" Override the root namespace (empty = auto-detect from .csproj)

Requirements

  • VS Code 1.85 or later.
  • An ASP.NET Core (.NET 6+) project.

Development

npm install
npm run compile        # build
npm run test:unit      # unit tests (mocha)
npm run test:integration  # integration test (requires VS Code download)
npm run package        # produce .vsix

Download

Prebuilt .vsix packages are attached to every GitHub Release. The rolling latest release always points at the newest build; the workflow run page also exposes the artifact.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages