Sendy 1.0.0.5
dotnet add package Sendy --version 1.0.0.5
NuGet\Install-Package Sendy -Version 1.0.0.5
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="Sendy" Version="1.0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sendy" Version="1.0.0.5" />
<PackageReference Include="Sendy" />
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 Sendy --version 1.0.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sendy, 1.0.0.5"
#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 Sendy@1.0.0.5
#: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=Sendy&version=1.0.0.5
#tool nuget:?package=Sendy&version=1.0.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sendy
Sendy is a small, lightweight .NET library for implementing the CQRS pattern (Command Query Responsibility Segregation).
It enables clean separation between write and read operations with minimal ceremony, and supports both synchronous and asynchronous handlers.
๐ Installation
Install via the .NET CLI:
dotnet add package Sendy
Or download it from NuGet.org
โ๏ธ Configuration
Register Sendy in your Startup.cs
or Program.cs
:
public void ConfigureServices(IServiceCollection services)
{
services.AddSendy(typeof(Program).Assembly);
}
๐งฑ Defining Commands & Queries
Implement one of the following interfaces:
Purpose | Interface |
---|---|
Command | IRequest , IAsyncRequest |
Query (with result) | IRequest<TResult> , IAsyncRequest<TResult> |
Example: Creating an Order
public class CreateOrderCommand : IRequest<Guid>
{
public string CustomerId { get; set; }
public List<string> ProductIds { get; set; }
}
Example: Querying Top Products
public class GetTopSellingProductsQuery : IAsyncRequest<List<ProductDto>>
{
public int TopCount { get; set; } = 5;
}
๐งฐ Implementing Handlers
Synchronous Command Handler
public class CreateOrderHandler : IHandler<CreateOrderCommand, Guid>
{
public Guid Handle(CreateOrderCommand request)
{
// Simulate saving to DB
var orderId = Guid.NewGuid();
Console.WriteLine($"Order {orderId} created for Customer {request.CustomerId}");
return orderId;
}
}
Asynchronous Query Handler
public class GetTopSellingProductsHandler : IAsyncHandler<GetTopSellingProductsQuery, List<ProductDto>>
{
public async Task<List<ProductDto>> Handle(GetTopSellingProductsQuery request)
{
// Simulate async DB call
await Task.Delay(100);
return new List<ProductDto>
{
new("Product A", 128),
new("Product B", 115),
new("Product C", 98)
}.Take(request.TopCount).ToList();
}
}
โ๏ธ Dispatching Commands and Queries
Synchronous
var orderId = _sendy.Send(new CreateOrderCommand
{
CustomerId = "cust-123",
ProductIds = new List<string> { "prod-1", "prod-2" }
});
Asynchronous
var topProducts = await _sendy.SendAsync(new GetTopSellingProductsQuery
{
TopCount = 3
});
๐งช DTOs Used in Examples
public record ProductDto(string Name, int UnitsSold);
โ Why Sendy?
- ๐น Clean separation of responsibilities (CQRS)
- ๐น Supports both sync and async flows
- ๐น Minimal boilerplate
- ๐น Testable and modular
- ๐น Fast to set up and extend
๐ License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.