Refactor messaging system to utilize LiteCqrs library
- 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:
@@ -98,10 +98,13 @@ backend/
|
||||
|
||||
- **Rich domain model**: инварианты в сущностях (приватные сеттеры, фабричные методы `Node.Register(...)`,
|
||||
поведенческие методы `config.Revoke()`), а не анемичные DTO-сущности.
|
||||
- **CQRS через собственный диспетчер**: хендлеры реализуют `ICommandHandler<TCommand,TResult>` /
|
||||
`IQueryHandler<,>`; `ISender` резолвит их из DI и прогоняет через `IPipelineBehavior<,>`
|
||||
(`ValidationBehavior` → `LoggingBehavior` → `UnitOfWorkBehavior`). Без внешних CQRS-библиотек, без
|
||||
доменных событий — хендлер сам вызывает нужные порты (realtime/Telegram/аудит) синхронно.
|
||||
- **CQRS через [LiteCqrs.Net](https://github.com/mrleo1nid/LiteCqrs.Net)** (собственная лёгкая
|
||||
CQRS-библиотека, не MediatR — сосед-репозиторий, пока подключён `ProjectReference`'ом): хендлеры
|
||||
реализуют `ICommandHandler<TCommand,TResult>` / `IQueryHandler<,>`; `ISender` резолвит их из DI и
|
||||
прогоняет через `IPipelineBehavior<,>` (`LoggingBehavior` → `ValidationBehavior` →
|
||||
`RequireActivationBehavior` → `UnitOfWorkBehavior`, порядок задан в `AddLiteCqrs(...)`). Без
|
||||
доменных событий — хендлер сам вызывает нужные порты (realtime/Telegram/аудит) синхронно;
|
||||
библиотека умеет Notifications/pub-sub, но PnvPanel их не использует.
|
||||
- **Порты в Application, адаптеры в Infrastructure/Api**: никакого `Npgsql`/`SignalR`/`ThreeXui.Net` в
|
||||
Application/Domain — только интерфейсы, реализации могут жить и в `Infrastructure`, и в `Api`
|
||||
(`IRealtimeNotifier` реализован в `Api/Hubs`, т.к. завязан на `IHubContext<PanelHub>`).
|
||||
|
||||
Reference in New Issue
Block a user