Refactor messaging system to utilize LiteCqrs library
CI / Backend (build + test) (push) Failing after 1m28s
CI / Frontend (lint + typecheck + build) (push) Successful in 47s

- Replaced instances of the previous messaging system with LiteCqrs across various application components, enhancing the CQRS implementation.
- Updated dependency injection to register LiteCqrs services and behaviors, streamlining command and query handling.
- Adjusted multiple command and query handlers to align with the new messaging framework, ensuring consistent functionality and improved maintainability.
- Added LiteCqrs package reference in the project file for better dependency management.
This commit is contained in:
Leonid Pershin
2026-07-24 04:16:38 +03:00
parent 4e1b63645f
commit b05b76f32f
266 changed files with 577 additions and 641 deletions
+8 -3
View File
@@ -133,9 +133,14 @@ PnvPanel — backend на **ASP.NET Core (.NET 10)** по принципам **C
- **Команды** меняют состояние, возвращают `Result` / `Result<T>`; выполняются в транзакции (UnitOfWorkBehavior).
- **Запросы** только читают; могут ходить в БД проекциями (`Select` в DTO) без загрузки сущностей целиком.
- Диспетчер — **собственный тонкий `ISender`**: резолвит хендлер команды/запроса из DI и прогоняет
через pipeline behaviors. Без внешних CQRS-библиотек (MediatR/и т.п.). Абстракции — `ICommand<T>`,
`IQuery<T>`, `ICommandHandler<,>`, `IQueryHandler<,>`, `IPipelineBehavior<,>`.
- Диспетчер — `ISender` из [`LiteCqrs.Net`](https://github.com/mrleo1nid/LiteCqrs.Net) (собственная
лёгкая CQRS-библиотека, альтернатива MediatR с явным разделением Command/Query — сосед-репозиторий
в `D:\Github`, пока подключён `ProjectReference`'ом, не через NuGet): резолвит хендлер
команды/запроса из DI (dynamic-free кэшированный диспетчер) и прогоняет через pipeline behaviors.
Абстракции — `ICommand<T>`, `IQuery<T>`, `ICommandHandler<,>`, `IQueryHandler<,>`,
`IPipelineBehavior<,>` — все из `LiteCqrs`; PnvPanel-специфичные behaviors (`ValidationBehavior`,
`RequireActivationBehavior`, `UnitOfWorkBehavior`) и маркер `IRequiresActivation` остаются в
`Application/Common/Behaviors`.
Пример потока «создать конфиг» (`backend/src/PnvPanel.Application/Configs/Create/CreateVpnConfigCommandHandler.cs`):
```