Dosaic.Plugins.Handlers.Cqrs 1.0.37

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

Dosaic.Plugins.Handlers.Cqrs

Dosaic.Plugins.Handlers.Cqrs is a plugin that provides CQRS implementation for basic resource operations, automatically registering handlers and validators for CRUD operations.

Installation

To install the nuget package follow these steps:

dotnet add package Dosaic.Plugins.Handlers.Cqrs

Appsettings.yml

No specific configuration in appsettings.yml is required for this plugin.

Configuration in your plugin host

No specific configuration available.

Features

  • Automatic registration of default CRUD handlers:

    • Create (ICreateHandler<>)
    • Update (IUpdateHandler<>)
    • Delete (IDeleteHandler<>)
    • Get (IGetHandler<>)
    • GetList (IGetListHandler<>)
  • Auto-discovery and registration of custom handlers implementing IHandler

  • Auto-discovery and registration of custom validators implementing IBaseValidator


Example Usage

Example service using the create handler, all handlers are to be used in the same way

public class UserService
{
    private readonly ICreateHandler<UserResource> _createHandler;

    public UserService(ICreateHandler<UserResource> createHandler)
    {
        _createHandler = createHandler;
    }

    public async Task<UserResource> CreateUserAsync(string name, CancellationToken cancellationToken)
    {
        var newUser = new UserResource { Name = name };
        return await _createHandler.CreateAsync(newUser, cancellationToken);
    }
}

// Example validator
public class UserResourceValidator : ICreateValidator<UserResource>
{
    public void ValidateOnCreate(UserResource resource)
    {
        if (string.IsNullOrEmpty(resource.Name))
            throw new ValidationException("Name is required");
    }
}

// Example repository implementation or use a Dosaic.Plugins.Persistence plugin for a database of your choice
public class UserResourceRepository : IRepository<UserResource>
{
    public async Task<UserResource> AddAsync(UserResource entity, CancellationToken cancellationToken)
    {
        // Implementation details...
        return entity;
    }

    // Other repository methods...
}
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Dosaic.Plugins.Handlers.Cqrs:

Package Downloads
Dosaic.Plugins.Endpoints.RestResourceEntity

A plugin-first dotnet framework for rapidly building anything hosted in the web.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.37 158 4/7/2025
1.0.36 481 3/25/2025
1.0.35 215 3/4/2025
1.0.34 215 3/4/2025
1.0.32 161 3/3/2025
1.0.30 115 1/30/2025
1.0.27 102 1/29/2025
1.0.26 102 1/29/2025
1.0.25 97 1/29/2025
1.0.18 109 1/23/2025
1.0.17 107 1/23/2025