Despro.Framework.Application 2.0.8

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

Despro.Framework.Application

The application (CQRS) layer of Despro Framework.

Despro.Framework.Application defines the CQRS contracts (commands, queries and their handlers) built on MediatR, plus the FluentValidation pipeline behavior that validates every command before it reaches a handler. This is the layer your use cases build directly on.

  • Package: Despro.Framework.Application
  • Version: 2.0.5
  • Target framework: net10.0
  • Depends on: Despro.Framework.Base, MediatR 14.0.0

Installation

dotnet add package Despro.Framework.Application

DI registration

using Despro.Framework.Application;

builder.Services.AddFrameworkApplication();

AddFrameworkApplication registers the CommandValidationBehavior<,> MediatR pipeline behavior and scans this assembly for FluentValidation validators. (The assemblies that contain your handlers/validators are registered separately by AddFrameworkInfrastructure.)


CQRS contracts (QueryCommandTools)

Commands — state-changing operations

Contract Returns
ICommand OperationResult
ICommand<TResponse> OperationResult<TResponse>
ICommandHandler<TCommand> handles ICommand
ICommandHandler<TCommand, TResponseData> handles ICommand<TResponseData>

Queries — read operations

Contract Returns
IQuery<TResponse> TResponse
IQueryOperation<TResponse> OperationQueryResult<TResponse>
QueryGrid<TResponse> (abstract, TResponse : BaseDto) GridData<TResponse>
QueryGridOperation<TResponse> (abstract, TResponse : BaseDto) OperationQueryResult<GridData<TResponse>>

Each query contract has a matching handler interface: IQueryHandler<,>, IQueryOperationHandler<,>, IQueryGridHandler<,>, IQueryGridOperationHandler<,>.

Validation pipeline

CommandValidationBehavior<TRequest, TResponse> runs all registered IValidator<TRequest> instances before the handler executes. If any rule fails it aggregates the messages and throws InvalidCommandException, short-circuiting the pipeline so handlers only ever run against valid input.

Exceptions (ApplicationExceptions)

  • BaseApplicationException (abstract, extends Base's BaseException).
  • InvalidCommandException — thrown by the validation behavior on validation failure.

Usage

// Command
public record CreateProductCommand(string Name, decimal Price) : ICommand<long>;

public class CreateProductCommandValidator : AbstractValidator<CreateProductCommand>
{
    public CreateProductCommandValidator()
    {
        RuleFor(x => x.Name).NotEmpty();
        RuleFor(x => x.Price).GreaterThan(0);
    }
}

public class CreateProductCommandHandler : ICommandHandler<CreateProductCommand, long>
{
    public async Task<OperationResult<long>> Handle(CreateProductCommand request, CancellationToken ct)
    {
        // ... persist and return
        return OperationResult<long>.Success(newId);
    }
}

// Grid query
public class ProductGridQuery(BaseGrid grid) : QueryGrid<ProductDto>(grid);

public class ProductGridQueryHandler : IQueryGridHandler<ProductGridQuery, ProductDto>
{
    public Task<GridData<ProductDto>> Handle(ProductGridQuery request, CancellationToken ct) { /* ... */ }
}

Dispatch through MediatR's ISender/IMediator; the validation behavior runs automatically.


Project structure

Despro.Framework.Application
├── ApplicationExceptions/   # BaseApplicationException, InvalidCommandException
├── QueryCommandTools/       # ICommand, IQuery, QueryGrid, CommandValidationBehavior
└── FrameworkApplicationDi.cs # AddFrameworkApplication
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
2.0.8 130 7/26/2026
2.0.7 114 7/18/2026
2.0.6 112 7/2/2026
2.0.5 122 7/2/2026