CrudBuster 1.0.4-beta1

This is a prerelease version of CrudBuster.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CrudBuster --version 1.0.4-beta1
                    
NuGet\Install-Package CrudBuster -Version 1.0.4-beta1
                    
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="CrudBuster" Version="1.0.4-beta1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CrudBuster" Version="1.0.4-beta1" />
                    
Directory.Packages.props
<PackageReference Include="CrudBuster" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CrudBuster --version 1.0.4-beta1
                    
#r "nuget: CrudBuster, 1.0.4-beta1"
                    
#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.
#:package CrudBuster@1.0.4-beta1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CrudBuster&version=1.0.4-beta1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CrudBuster&version=1.0.4-beta1&prerelease
                    
Install as a Cake Tool

CrudBuster

Automatic CRUD Endpoint Generator for ASP.NET Core Minimal APIs (Beta)

CrudBuster, allows you to quickly and flexibly generate CRUD (Create, Read, Update, Delete) endpoints in your ASP.NET Core applications. You can define your endpoints without relying on any interface by integrating your own service classes through delegates.

Features

  • Automatic CRUD Endpoint Generation: Create GET, POST, PUT, and DELETE endpoints with a single method.
  • Flexible Service Integration: Works with any service class thanks to its delegate-based structure.
  • Authorization Support: You can add custom authorization policies to your endpoints.
  • Minimal API Support: Optimized for .NET 6 and later.
  • Beta Release: Currently in beta — we welcome your feedback!

Installation

Add the NuGet package to your project:

Feedback

Thank you for testing our beta version! You can share your issues or suggestions via GitHub Issues.

Usage

//ViewModels()
public record ProductCreateViewModel(Guid Id, string Name);
public record ProductUpdateViewModel(Guid Id, string Name);
public record ProductDeleteViewModel(Guid Id, string Name);
public record ProductGetViewModel(Guid Id, string Name);
public record ProductListViewModel(Guid Id, string Name);

...
    
public interface IRepository
{
    Task GetListAsync();
    Task GetByIdAsync();
    Task CreateAsync();
    Task UpdateAsync();
    Task DeleteAsync();
}

public async Task<Result<List<TListViewModel>>> GetListAsync()
{
    var response = new Result<List<TListViewModel>>();
    var data = await _repository.GetAllAsync(x=>x.Status == Status.Active);

    if (data is not null)
        response.Data = _mapper.Map<List<TListViewModel>>(data);
    else
        response.Message = "Something went wrong";

    return response;
}
... 
    
    public class Result<T>
    {
        public bool Status { get; set; }
        public string Message { get; set; }
        public T Data { get; set; }
    }
    
...

     app.CrudBuster(options =>
{
    //It searches for entities in this layer.
    options.DomainLayerName = "Domain";
    
    //It searches for view models in this layer.
    options.ViewModelsLayerName = "Application";
    
    //It searches for repo in this layer.
    options.RepositoryLayerName = "Infrastructure";

    //In this field, you must assign the last part of the name you used in your view model classes. For example: ProductCreateViewModel, ProductCreateVM, ProductCreateDTO, or whatever naming convention you follow.
    options.ViewModelPattern = "ViewModel or DTO or VM etc...";
    
    //This field specifies which permissions can access the controller. You can set it to null
    options.AuthorizationPolicy = "Admin, SuperAdmin"; 
    
    options.RepositoryName = "IRepository"; //!!! It has to be the same as the name of the repository.".
    
    options.GetListService = "GetListAsync"; //!!! It must be the same as the method name in the repository.
    options.GetByIdService = "GetByIdAsync"; //!!! It must be the same as the method name in the repository.
    options.DeleteService = "DeleteAsync";   //!!! It must be the same as the method name in the repository.
    options.CreateService = "CreateAsync";   //!!! It must be the same as the method name in the repository.
    options.UpdateService = "UpdateAsync";   //!!! It must be the same as the method name in the repository.
    
    //Where will the obtained data be assigned? You should provide the name of the base response field in this area.
    options.ApiResulClassName = "Result";
    
    options.BaseEntityName="IEntity"; // !!!The database tables must have the same name as the base entity class they inherit from.
});

Binance

  • BTC: 13mzeg11nGAHwx5WtHye5dpNTQxbsb1T2v

  • ETH: 0xadcdb8c83207821f86e9ff683cc74fa45e48ca30

  • SOL: EdQCWcWmvsEJq9PxnVegviJipcExZUUgEz2ZZTBbhQVa

dotnet add package CrudBuster --version 1.0.0-beta1 --prerelease
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Beta release with basic CRUD endpoint generation for ASP.NET Core minimal APIs.