Employee Dependency Injection
Summary
Program.cs is the composition root. It registers request-scoped application and persistence components, singleton messaging components through the shared kernel, authentication/authorization, observability, health, and presentation discovery.
Audience
- Backend developers
- DevOps engineers and solution architects
Reference Content
Dependency graph
Scoped registrations
The tenant context, persistence context, outbox store, repositories, timeline repository, unit of work, audit writer, application services, organization services, validators, command handlers, query handlers, and search provider are scoped. This aligns tracked persistence state and request identity within one request scope.
Shared-kernel registrations
Messaging configuration binds messaging options, registers a singleton event bus and publisher, and creates a scoped outbox processor when an outbox store is available. Observability registers configuration, logging, and tracing.
Startup
The host builds its middleware pipeline, optionally applies migrations, optionally seeds development data, enables correlation, authentication, authorization, health, service information, and presentation mappings, then runs.
Options
RabbitMQ uses option binding in the shared kernel. Other Employee categories are read directly from host configuration. No Employee-specific strongly typed options class was found.
Source References
microservices/src/employee-service/Program.csmicroservices/src/shared-kernel/Extensions/MessagingExtensions.csmicroservices/src/shared-kernel/Extensions/ObservabilityExtensions.cs
Related Articles
See Also
Keywords
- Composition root
- Scoped services
- Service lifetime
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly