Sharkable.AutoCrud.SqlSugar 0.5.6

dotnet add package Sharkable.AutoCrud.SqlSugar --version 0.5.6
                    
NuGet\Install-Package Sharkable.AutoCrud.SqlSugar -Version 0.5.6
                    
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="Sharkable.AutoCrud.SqlSugar" Version="0.5.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sharkable.AutoCrud.SqlSugar" Version="0.5.6" />
                    
Directory.Packages.props
<PackageReference Include="Sharkable.AutoCrud.SqlSugar" />
                    
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 Sharkable.AutoCrud.SqlSugar --version 0.5.6
                    
#r "nuget: Sharkable.AutoCrud.SqlSugar, 0.5.6"
                    
#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 Sharkable.AutoCrud.SqlSugar@0.5.6
                    
#: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=Sharkable.AutoCrud.SqlSugar&version=0.5.6
                    
Install as a Cake Addin
#tool nuget:?package=Sharkable.AutoCrud.SqlSugar&version=0.5.6
                    
Install as a Cake Tool

Sharkable.AutoCrud.SqlSugar

Automatic CRUD API generation for Sharkable with SqlSugar ORM.

Install

dotnet add package Sharkable.AutoCrud.SqlSugar

Usage

Step 1: Configure DB

builder.Services.AddShark(opt =>
{
    opt.ConfigureAutoCrud(s =>
    {
        s.DbType = DbType.Sqlite;
        s.ConnectionString = "DataSource=app.db";
    });
});

Step 2: Define entity + endpoint

[SugarTable("products")]
public class Product
{
    [SugarColumn(IsPrimaryKey = true)]
    public int Id { get; set; }
    public string Name { get; set; } = "";
    public decimal Price { get; set; }
}

public class ProductEndpoint : ISharkEndpoint, IAutoCrudEntity<Product>
{
    // Empty — all 5 CRUD operations auto-generated
}

Auto-generated routes (api/product):

Method Route Operation
GET / List all
GET /{id} Get by ID
POST / Create
PUT /{id} Update
DELETE /{id} Delete

Suppress Operations

public class ReadOnlyEndpoint : ISharkEndpoint, IAutoCrudEntity<Product>
{
    CrudOperations IAutoCrudEntity<Product>.AllowedOperations =>
        CrudOperations.List | CrudOperations.Get;
    // POST/PUT/DELETE suppressed
}

Custom Override

Write your own route in AddRoutes — it takes precedence over auto-generated:

public class ProductEndpoint : ISharkEndpoint, IAutoCrudEntity<Product>
{
    public void AddRoutes(IEndpointRouteBuilder app)
    {
        // Override the auto-generated GET list
        app.MapGet("/", async (ISqlSugarClient db) =>
        {
            var list = await db.Queryable<Product>()
                .Where(p => p.Price > 0)
                .OrderBy(p => p.Name)
                .ToListAsync();
            return Results.Ok(list);
        });
    }
}

Health Check

SqlSugar database connectivity is automatically checked via /healthz (when EnableHealthChecks = true):

{
  "checks": {
    "SqlSugar": {
      "status": "healthy",
      "description": "SqlSugar connected in 3ms",
      "data": { "latencyMs": 3, "dbType": "Sqlite" }
    }
  }
}

License

MIT

There are no supported framework assets in this 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.

Version Downloads Last Updated
0.5.6 96 7/3/2026
0.5.5 98 7/2/2026
0.5.4 93 7/1/2026
0.5.3 109 6/30/2026
0.5.0 114 6/29/2026
0.4.1 111 6/28/2026
0.3.2 114 6/27/2026
0.0.23 257 9/27/2024
0.0.22 253 9/27/2024 0.0.22 is deprecated because it is no longer maintained and has critical bugs.
0.0.20 190 9/24/2024
0.0.18 229 9/24/2024

CS1591 XML doc comments on all public API types and members (fix). CS1574 unresolved cref references (fix). Bump Sharkable dependency to 0.5.6.