Skip to main content

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, TemplateEngine and PreferenceEvaluator take NotificationDbContext directly — persistence is reached without a repository interface.
  • Channels depend on the IChannelSender and SendContext abstractions and the NotificationMessage domain type; they do not depend on the DbContext.
  • Infrastructure depends on Domain for 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.cs
  • microservices/src/notification-service/Application/NotificationDispatcher.cs
  • microservices/src/notification-service/Channels/ChannelSenderRegistry.cs
  • microservices/src/notification-service/Domain/NotificationEntities.cs

See Also

Keywords

Layer dependencies, boundaries, dependency direction, coupling.

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Next review: 2026-10-21