DessCore 3.1.14

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

DessCore

DessCore is a .NET 10 development framework designed for enterprise-grade ASP.NET Core applications. It integrates data access, authentication/authorization, caching, cryptography, and common business-service abstractions into a single, dependency-injection-ready library.

Features

  • Data Access — built on FreeSql with multi-database support, automatic schema synchronization, PostgreSQL partitioning, and Snowflake-style ID generation.
  • Generic Business Service — SimpleModelService<T> provides a unified CRUD pipeline with attribute-driven primary/unique/sort keys, FluentValidation integration, soft-delete support, and permission hooks.
  • Authentication — JWT token issuing, validation, caching, renewal, and JWE encryption backed by Microsoft.AspNetCore.Authentication.JwtBearer.
  • Caching — multi-instance Redis connection pools with key prefixes, configurable via RedisOptions.
  • Authorization — method-level permission attributes (AppAuthAttribute) and automatic permission initialization into AppAuthModel.
  • Auto-Registration — [AutoAddScoped] and [AutoAddSingleton] attributes enable assembly-scanning service registration by ApplicationID.
  • Cryptography — AES, RSA, SM2/SM3/SM4, hashing, and digital signature utilities.
  • Utilities — Excel helpers, string/entity extensions, date/time utilities, GPS helpers, and more.

Requirements

  • .NET 10 SDK or later
  • A supported database for FreeSql (e.g., PostgreSQL, MySQL, SQL Server, SQLite)
  • Redis (optional, required for token caching and permission caching)

Installation

From NuGet (when published)

dotnet add package DessCore

Local project reference

<ItemGroup>
  <ProjectReference Include="..\DessCore\DessCore.csproj" />
</ItemGroup>

Quick Start

1. Configure appsettings.json

{
  "ApplicationID": "MyApp",
  "DAO": {
    "DataType": "PostgreSQL",
    "Connection": "Host=localhost;Port=5432;Database=mydb;Username=postgres;Password=postgres",
    "AutoSync": true,
    "AutoInitAuth": true
  },
  "Redis": {
    "ConnectionString": "localhost:6379,defaultDatabase=0"
  },
  "JWT": {
    "SecurityKey": "your-256-bit-secret-key-here",
    "Issuer": "DessCore",
    "Audience": "DessCore",
    "ExpiresHour": 2
  }
}

2. Register services in Program.cs

using DessCore.DI.Builder;
using DessCore.DI.DbServices;
using DessCore.DI.Jwt;
using DessCore.DI.Redis;

var builder = WebApplication.CreateBuilder(args);

// Register Redis, database services, and JWT
builder.Services.AddRedisService(builder.Configuration);
builder.Services.AddSingleton<IDbService, DbServices>();
builder.Services.AddSingleton<IJwt, JwtService>();

// Auto-register attributed services
AutoAddScoped.AddScoped(builder.Configuration, builder.Services);
AutoAddSingleton.AddSingleton(builder.Configuration, builder.Services);

var app = builder.Build();
app.Run();

3. Create a business service

using DessCore.Attributes.DB;
using DessCore.Extend;
using FluentValidation;

public class Product
{
    [SimpleModelId]
    public long Id { get; set; }

    [SimpleModelUnique]
    public string Code { get; set; } = string.Empty;

    public string Name { get; set; } = string.Empty;
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
}

public class ProductValidator : AbstractValidator<Product>
{
    public ProductValidator()
    {
        RuleFor(p => p.Name).NotEmpty().MaximumLength(200);
    }
}

public class ProductService : SimpleModelService<Product>
{
    public ProductService(IDbService dbService) : base(dbService) { }

    protected override AbstractValidator<Product> Validator => new ProductValidator();
    protected override Func<int> GetUtcOffset => () => 8;

    protected override Task<bool> AuthValidator(string actionName)
    {
        // Implement your permission logic here
        return Task.FromResult(true);
    }
}

4. Use the service in a controller

[ApiController]
[Route("[controller]")]
public class ProductsController : ControllerBase
{
    private readonly ProductService _service;

    public ProductsController(ProductService service) => _service = service;

    [HttpPost("list")]
    public async Task<IActionResult> List([FromBody] ProductSearch request)
    {
        var (rows, total) = await _service.TableList(request);
        return Ok(new { data = rows, total });
    }

    [HttpPost]
    public async Task<IActionResult> Create([FromBody] Product product)
    {
        var created = await _service.Create(product);
        return Ok(created);
    }
}

Project Structure

DessCore/
├── Attributes/         # Metadata and DI attributes (Auth, Builder, DB, Vue)
├── DI/                 # Dependency-injection services (DbServices, Jwt, Redis, ApiJsonResult)
├── Data/               # Domain/config models (AppAuthModel, IClientInfo)
├── Extend/             # Business extensions and SimpleModelService
├── Filter/             # Web API filters
└── Utilities/          # Cryptography utilities (AES, RSA, SM2/SM3/SM4)

Core Dependencies

  • FreeSql and extensions (JsonMap, Linq, Repository)
  • StackExchange.Redis
  • Microsoft.AspNetCore.Authentication.JwtBearer
  • FluentValidation
  • BouncyCastle.Cryptography, NSec.Cryptography, Sodium.Core
  • Newtonsoft.Json, MiniExcel, RabbitMQ.Client, IdGen, IdleBus

For the full dependency list, see DessCore.csproj.

Documentation

  • API reference and module guides are maintained under .qoder/repowiki/zh/content/.
  • Unit-test examples can be found in TestProject.

Security

DessCore has undergone security hardening for common .NET vulnerabilities, including SQL-injection defenses, ECDH IV handling, and timing-attack mitigations. Transitive dependencies with known vulnerabilities (for example System.Security.Cryptography.Xml) are pinned to patched versions.

License

DessCore is licensed under the MIT License.

Contributing

Contributions are welcome. Please ensure that XML comments and project metadata remain in English, and that new features include relevant unit tests. DessCore

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

Version Downloads Last Updated
3.1.14 164 8/12/2026
3.1.13 147 7/7/2026

Update to .NET 10; UpdateNuGet packages.