NPv.CQS.Abstraction
1.0.0
Global renaming
dotnet add package NPv.CQS.Abstraction --version 1.0.0
NuGet\Install-Package NPv.CQS.Abstraction -Version 1.0.0
<PackageReference Include="NPv.CQS.Abstraction" Version="1.0.0" />
<PackageVersion Include="NPv.CQS.Abstraction" Version="1.0.0" />
<PackageReference Include="NPv.CQS.Abstraction" />
paket add NPv.CQS.Abstraction --version 1.0.0
#r "nuget: NPv.CQS.Abstraction, 1.0.0"
#:package NPv.CQS.Abstraction@1.0.0
#addin nuget:?package=NPv.CQS.Abstraction&version=1.0.0
#tool nuget:?package=NPv.CQS.Abstraction&version=1.0.0
NPv.CQS.Abstractions
Minimal, dependency-free contracts for applications following the Command-Query Separation (CQS) pattern.
β¨ Overview
NPv.CQS.Abstractions
is a foundational library containing interfaces and contracts for building systems based on the Command-Query Separation (CQS) principle.
It does not include any infrastructure or implementation β just the minimal building blocks: declarative command and query builders that allow infrastructure to resolve and invoke handlers automatically.
Use this package in your domain, application, or core layers to define behaviors without pulling in any dependencies.
π§ Interfaces Included
π’ Commands
Interface | Purpose |
---|---|
ICommand<TContext> |
Represents an action that changes system state (fire-and-forget) |
ICommandBuilder |
Resolves and executes a command based on the given context. Allows declarative usage and central orchestration (e.g., in infrastructure or faΓ§ade services) |
ICommandContext |
Encapsulates input data for building a command (e.g., DTO, form model, metadata) |
π΅ Queries
Interface | Purpose |
---|---|
IQuery<TCriterion, TResult> |
Represents a read-only operation that returns data for a specific criterion |
ICriterion |
Input object used to filter, locate, or define query parameters in a composable and type-safe way |
IQueryBuilder |
Resolves and executes a query using a registered builder based on the criterion type and expected result type. Useful for declarative, infrastructure-level orchestration |
IQueryFor<TEntity> |
Marker interface for queries that return a specific entity type |
π¦ Installation
dotnet add package NPv.CQS.Abstractions
π‘ Example
public record CreateOrderCommandContext(Guid OrderId, decimal Amount) : ICommandContext;
public class CreateOrderCommand : ICommand<CreateOrderCommandContext>
{
public async Task ExecuteAsync(CreateOrderCommandContext context)
{
// Your domain logic here
await DoWork();
}
}
public record FindById(Guid Id) : ICriterion;
public class FindOrderByIdQuery(IOrderService _orderService) : IQuery<FindById, Order>
{
public async Task<Order> AskAsync(ICriterion criterion) =>
await _orderService.Get(criterion.Id);
}
π Designed For Use With
NPv.CQS.Infrastructure
β implementation (dispatcher, DI, Autofac module)- Any CQS/CQRS-based application structure
βοΈ License
MIT β you are free to use this in commercial and open-source software.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- No dependencies.
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 |
---|