Notification Layer Dependencies
Summary
Dependencies flow inward toward the domain. The API and messaging layers depend on the application layer; the application layer depends on domain entities and the infrastructure DbContext; channel senders implement an application-defined abstraction. The domain layer depends on nothing project-specific.
Dependency direction
Verified boundaries
- Domain (
NotificationEntities.cs) contains only POCO entities and static constant classes. It references no EF Core, ASP.NET Core, messaging or channel type. - Application defines the service abstractions (
Abstractions.cs) and their implementations.NotificationDispatcher,TemplateEngineandPreferenceEvaluatortakeNotificationDbContextdirectly — persistence is reached without a repository interface. - Channels depend on the
IChannelSenderandSendContextabstractions and theNotificationMessagedomain type; they do not depend on the DbContext. - Infrastructure depends on
Domainfor entity mapping. - Messaging depends on
Application(INotificationDispatcher) and shared-kernel messaging types; it resolves the dispatcher per delivery through a DI scope. - Contracts provide the event payload record types deserialized by
EventNotificationResolver.
Coupling notes
The application layer’s direct use of NotificationDbContext is an intentional, verified choice for this bounded context (the dispatcher owns notification data). This couples orchestration to EF Core but keeps the domain model persistence-agnostic.
Requires Confirmation
Whether a repository abstraction is planned to decouple orchestration from EF Core requires confirmation; none exists today.
Source References
microservices/src/notification-service/Application/Abstractions.csmicroservices/src/notification-service/Application/NotificationDispatcher.csmicroservices/src/notification-service/Channels/ChannelSenderRegistry.csmicroservices/src/notification-service/Domain/NotificationEntities.cs
Related Articles
See Also
Keywords
Layer dependencies, boundaries, dependency direction, coupling.
Revision Information
- Status: Draft
- Last reviewed: 2026-07-21
- Next review: 2026-10-21