Reo.Core.Application.Abstractions.MediatR 6.0.520

There is a newer version of this package available.
See the version list below for details.
dotnet add package Reo.Core.Application.Abstractions.MediatR --version 6.0.520
                    
NuGet\Install-Package Reo.Core.Application.Abstractions.MediatR -Version 6.0.520
                    
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="Reo.Core.Application.Abstractions.MediatR" Version="6.0.520" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reo.Core.Application.Abstractions.MediatR" Version="6.0.520" />
                    
Directory.Packages.props
<PackageReference Include="Reo.Core.Application.Abstractions.MediatR" />
                    
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 Reo.Core.Application.Abstractions.MediatR --version 6.0.520
                    
#r "nuget: Reo.Core.Application.Abstractions.MediatR, 6.0.520"
                    
#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 Reo.Core.Application.Abstractions.MediatR@6.0.520
                    
#: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=Reo.Core.Application.Abstractions.MediatR&version=6.0.520
                    
Install as a Cake Addin
#tool nuget:?package=Reo.Core.Application.Abstractions.MediatR&version=6.0.520
                    
Install as a Cake Tool

Reo.Core.Application.Abstractions.MediatR

Описание пакета

Пакет Reo.Core.Application.Abstractions.MediatR предоставляет абстракции для интеграции с библиотекой MediatR в приложениях на C#. Он упрощает обработку доменных команд, событий и команд с результатами, добавляя логирование, обработку ошибок и стандартные шаблоны для работы с архитектурой CQRS. Пакет решает проблему стандартизации обработки операций в приложениях, где требуется разделение команд (commands), событий (events) и операций с возвращаемым результатом (commands with results).

Основные компоненты

  • IReoApplicationService<TDomainCommandsExecutor, TQuery> Интерфейс для сервисов приложения, которые выполняют операции с использованием доменных команд. Предоставляет метод ExecuteAsync для асинхронного выполнения запросов.

  • ReoDomainCommandHandler<TDomainCommand> Абстрактный класс для обработки доменных команд. Реализует IRequestHandler<TDomainCommand> и добавляет логирование и обработку ошибок.

  • ReoDomainCommandWithResultHandler<TDomainCommand> Абстрактный класс для обработки команд с возвращаемым результатом. Реализует IRequestHandler<TDomainCommand, bool> и добавляет логирование результата выполнения.

  • ReoDomainEventHandler<TDomainEvent> Абстрактный класс для обработки доменных событий. Реализует INotificationHandler<TDomainEvent> и добавляет логирование и обработку ошибок.

  • ServiceCollectionExtensions Методы расширения для регистрации сервисов приложения в контейнере зависимостей (DI) в ASP.NET Core.

Требования

Установка

Используйте следующие команды для установки пакета:

Install-Package Reo.Core.Application.Abstractions.MediatR
dotnet add package Reo.Core.Application.Abstractions.MediatR

Настройка

Регистрация в DI (ASP.NET Core)

Добавьте сервисы в контейнер зависимостей с помощью метода расширения:

services.AddReoApplicationServices<YourAssembly>();

Замените Reo.Core.Application.Abstractions.MediatR на сборку вашего проекта.

Конфигурационные параметры

N/A. Пакет не требует дополнительной конфигурации.

Использование

Пример 1: Обработка команды

public class CreateUserCommand : IRequest
{
    public string Username { get; set; }
}

public class CreateUserCommandHandler : ReoDomainCommandHandler<CreateUserCommand>
{
    protected override Task InnerHandleAsync(CreateUserCommand command, CancellationToken cancellationToken)
    {
        // Логика создания пользователя
        return Task.CompletedTask;
    }
}

Пример 2: Обработка команды с результатом

public class ValidateUserCommand : IRequest<bool>
{
    public string Username { get; set; }
}

public class ValidateUserCommandHandler : ReoDomainCommandWithResultHandler<ValidateUserCommand>
{
    protected override Task<bool> InnerHandleAsync(ValidateUserCommand command, CancellationToken cancellationToken)
    {
        // Проверка пользователя
        return Task.FromResult(true);
    }
}

Пример 3: Использование сервиса в контроллере

[ApiController]
[Route("api/[controller]")]
public class UserController : ControllerBase
{
    private readonly IReoApplicationService<..., CreateUserCommand> _service;

    public UserController(IReoApplicationService<..., CreateUserCommand> service)
    {
        _service = service;
    }

    [HttpPost]
    public async Task<IActionResult> CreateUser([FromBody] CreateUserCommand command)
    {
        await _service.ExecuteAsync(command, CancellationToken.None);
        return Ok();
    }
}

Лицензия

Этот пакет распространяется под лицензией 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 was computed.  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
8.0.522 111 8/28/2025
8.0.521 121 8/27/2025
8.0.520 120 8/27/2025
8.0.519 122 8/27/2025
8.0.518 130 8/27/2025
8.0.517 143 8/25/2025
8.0.516 263 8/25/2025
8.0.515 191 8/24/2025
8.0.514 129 8/21/2025
8.0.513 121 8/20/2025
8.0.512 119 8/20/2025
8.0.511 124 8/20/2025
8.0.510 121 8/18/2025
8.0.509 126 8/18/2025
8.0.508 130 8/13/2025
8.0.506 131 8/13/2025
8.0.505 128 8/13/2025
8.0.504 127 8/13/2025
8.0.503 130 8/13/2025
8.0.502 127 8/12/2025
8.0.501 132 8/12/2025
8.0.500 126 8/12/2025
8.0.499 126 8/12/2025
8.0.498 125 8/11/2025
8.0.497 163 8/8/2025
8.0.496 172 8/8/2025
8.0.495 171 8/8/2025
8.0.494 193 8/8/2025
8.0.493 207 8/7/2025
8.0.492 210 8/7/2025
8.0.491 202 8/7/2025
8.0.490 208 8/7/2025
8.0.489 217 8/5/2025
8.0.488 217 8/5/2025
8.0.487 81 8/1/2025
8.0.486 101 7/30/2025
8.0.485 99 7/28/2025
8.0.484 90 7/28/2025
8.0.483 91 7/28/2025
8.0.482 91 7/28/2025
8.0.481 90 7/28/2025
8.0.480 349 7/25/2025
8.0.479 375 7/25/2025
8.0.478 377 7/25/2025
8.0.477 384 7/25/2025
8.0.476 387 7/25/2025
8.0.475 438 7/24/2025
8.0.474 439 7/24/2025
8.0.473 491 7/23/2025
8.0.472 488 7/23/2025
8.0.470 487 7/23/2025
8.0.469 492 7/23/2025
8.0.468 490 7/23/2025
8.0.467 487 7/23/2025
8.0.466 487 7/23/2025
8.0.465 488 7/23/2025
8.0.464 487 7/23/2025
8.0.463 483 7/23/2025
8.0.462 484 7/22/2025
8.0.461 484 7/22/2025
8.0.460 366 7/21/2025
8.0.459 47 7/18/2025
8.0.458 81 7/18/2025
8.0.457 113 7/17/2025
8.0.456 111 7/17/2025
8.0.455 111 7/17/2025
8.0.454 115 7/17/2025
8.0.453 113 7/17/2025
8.0.452 110 7/17/2025
8.0.451 111 7/17/2025
8.0.450 112 7/17/2025
8.0.449 113 7/17/2025
8.0.448 113 7/17/2025
8.0.447 113 7/16/2025
8.0.446 112 7/16/2025
8.0.445 115 7/16/2025
8.0.444 117 7/16/2025
8.0.443 122 7/16/2025
8.0.442 124 7/16/2025
8.0.439 135 7/15/2025
8.0.438 130 7/15/2025
8.0.437 135 7/15/2025
8.0.436 129 7/15/2025
8.0.435 130 7/15/2025
8.0.433 134 7/14/2025
8.0.432 135 7/14/2025
8.0.431 116 7/11/2025
8.0.430 118 7/11/2025
8.0.429 140 7/10/2025
8.0.428 133 7/10/2025
8.0.427 136 7/9/2025
8.0.426 134 7/8/2025
8.0.425 137 7/8/2025
8.0.424 135 7/8/2025
8.0.423 134 7/8/2025
8.0.422 133 7/8/2025
8.0.421 140 7/8/2025
8.0.420 132 7/7/2025
8.0.419 130 7/7/2025
8.0.418 130 7/7/2025
8.0.417 135 7/7/2025
8.0.416 134 7/6/2025
8.0.415 97 7/4/2025
8.0.414 110 7/4/2025
8.0.411 141 7/3/2025
8.0.410 138 7/3/2025
8.0.409 143 7/3/2025
8.0.408 129 7/1/2025
8.0.407 128 7/1/2025
8.0.406 126 7/1/2025
8.0.405 138 7/1/2025
8.0.404 147 6/26/2025
8.0.403 124 6/26/2025
8.0.401 178 6/24/2025
8.0.400 138 6/24/2025
8.0.399 136 6/23/2025
8.0.398 139 6/23/2025
8.0.397 98 6/20/2025
8.0.396 152 6/19/2025
8.0.395 140 6/18/2025
8.0.394 143 6/18/2025
8.0.392 140 6/18/2025
8.0.390 145 6/18/2025
6.0.522 109 8/28/2025
6.0.521 120 8/27/2025
6.0.520 119 8/27/2025
6.0.519 121 8/27/2025
6.0.518 117 8/27/2025
6.0.517 142 8/25/2025
6.0.516 261 8/25/2025
6.0.515 189 8/24/2025
6.0.514 118 8/21/2025
6.0.513 120 8/20/2025
6.0.512 116 8/20/2025
6.0.511 121 8/20/2025
6.0.510 118 8/18/2025
6.0.509 121 8/18/2025
6.0.508 126 8/13/2025
6.0.506 125 8/13/2025
6.0.505 122 8/13/2025
6.0.504 133 8/13/2025
6.0.503 125 8/13/2025
6.0.502 126 8/12/2025
6.0.501 123 8/12/2025
6.0.500 129 8/12/2025
6.0.499 127 8/12/2025
6.0.498 124 8/11/2025
6.0.497 158 8/8/2025
6.0.496 166 8/8/2025
6.0.495 166 8/8/2025
6.0.494 194 8/8/2025
6.0.493 201 8/7/2025
6.0.492 200 8/7/2025
6.0.491 198 8/7/2025
6.0.490 202 8/7/2025
6.0.489 219 8/5/2025
6.0.488 215 8/5/2025
6.0.487 82 8/1/2025
6.0.486 100 7/30/2025
6.0.485 89 7/28/2025
6.0.484 86 7/28/2025
6.0.483 90 7/28/2025
6.0.482 92 7/28/2025
6.0.481 90 7/28/2025
6.0.480 352 7/25/2025
6.0.479 377 7/25/2025
6.0.478 372 7/25/2025
6.0.477 386 7/25/2025
6.0.476 388 7/25/2025
6.0.475 436 7/24/2025
6.0.474 435 7/24/2025
6.0.473 489 7/23/2025
6.0.472 487 7/23/2025
6.0.470 486 7/23/2025
6.0.469 492 7/23/2025
6.0.468 486 7/23/2025
6.0.467 489 7/23/2025
6.0.466 486 7/23/2025
6.0.465 486 7/23/2025
6.0.464 485 7/23/2025
6.0.463 484 7/23/2025
6.0.462 481 7/22/2025
6.0.461 484 7/22/2025
6.0.460 365 7/21/2025
6.0.459 47 7/18/2025
6.0.458 74 7/18/2025
6.0.457 110 7/17/2025
6.0.456 117 7/17/2025
6.0.455 114 7/17/2025