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" />
                    
Directory.Packages.props
<PackageReference Include="Sendy" />
                    
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 Sendy --version 1.0.0.5
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Sendy&version=1.0.0.5
                    
Install as a Cake Tool

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 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.

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
1.0.0.5 136 4/4/2025
1.0.0.4 167 4/3/2025
1.0.0.3 161 4/3/2025
1.0.0.2 302 9/27/2022
1.0.0.1 196 9/27/2022
1.0.0 199 9/27/2022