Ledon.Application 0.0.1

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

Ledon.Application

应用层统一入口(CQRS + 管线):处理器只写业务,验证/日志/事务/缓存由行为按顺序织入。

builder.Services.AddLedonApplication(o =>
{
    o.UseValidation();     // IValidatable 请求先校验(失败抛 ValidationException,不进处理器)
    o.UseLogging();        // 请求类型 + 耗时 + span
    o.UseTransactions();   // 包进 IUnitOfWork(未注册事务服务时直通)
    o.UseCaching();        // ICacheableQuery 查询自动走缓存
});

命令/查询与处理器(约定扫描自动注册,无需手写接口约定):

public sealed record CreateOrder(string Sku, int Qty) : ICommand<Guid>, IValidatable
{
    public IReadOnlyCollection<string> Validate() =>
        Qty <= 0 ? ["数量必须大于 0"] : [];
}

public class CreateOrderHandler(IUnitOfWork uow) : ICommandHandler<CreateOrder, Guid>
{
    public async Task<Guid> HandleAsync(CreateOrder command, CancellationToken ct = default) { /* 只管业务 */ }
}

// 调用方(端点/控制器)
var id = await sender.SendAsync(new CreateOrder("SKU-1", 2), ct);
  • 行为顺序 = 登记顺序(外层先执行):验证 → 日志 → 事务 → 缓存;
  • 自定义行为:实现 IPipelineBehavior<TRequest>,o.AddBehavior(BehaviorRegistration.All<MyBehavior>());
  • 事务行为与 Ledon.Transactions 是同一种写法(处理器里 SaveChanges,提交/回滚由行为负责);
  • 无返回值命令:ICommand + ICommandHandler<TCommand>。

完整文档:https://github.com/wosledon/ledon-framework

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
0.0.1 46 10/28/2026