How zokirs/onion-architecture works
This repository implements a company-and-employee management system with an API, a browser client, and IdentityServer-based identity features. The main API workflow routes company and employee requests through presentation controllers into application handlers or domain services, with persistence through repositories and Entity Framework. Authentication is handled both by API token services and by the identity-provider applications. The graph includes documented identity features, but their end-to-end wiring and the client’s API calls are not fully evidenced by the excerpts; those links are omitted or marked unverified.
Main entry points: CompaniesController.cs Companies API · RepositoryManager.cs Repository manager · ServiceManager.cs Service manager · AccountController.cs Identity account
Components 21
User interfaces
- Companies API
CompanyEmployees.Presentation/Controllers/CompaniesController.cs - Employees API
CompanyEmployees.Presentation/Controllers/EmployeesController.cs - Web client
CompanyEmployees.Client/Controllers/HomeController.cs
Application workflows
- Company workflows
Application/Handlers - Deletion notification
Application/Notifications/CompanyDeletedNotification.cs
Domain services
- Employee service
Service/EmployeeService.cs - Company service
Service/CompanyService.cs - Service manager
Service/ServiceManager.cs - API authentication
Service/AuthenticationService.cs
Persistence
- Repository manager
Repository/RepositoryManager.cs - Company repository
Repository/CompanyRepository.cs - Employee repository
Repository/EmployeeRepository.cs - Application database
Repository/RepositoryContext.cs
Identity
- Identity user store
CompanyEmployees.IDP/Entities/UserContext.cs - Identity account
CompanyEmployees.IDP/Quickstart/Account/AccountController.cs - Consent workflow
CompanyEmployees.IDP/Quickstart/Consent/ConsentController.cs - Device authorization
CompanyEmployees.IDP/Quickstart/Device/DeviceController.cs - User grants
CompanyEmployees.IDP/Quickstart/Grants/GrantsController.cs - Email delivery
EmailService/EmailSender.cs
Other components
- API caller
- Browser user
Connections 20
- API caller → Companies API: requests
CompanyEmployees.Presentation/Controllers/CompaniesController.cs - Companies API → Company workflows: dispatches queries
CompanyEmployees.Presentation/Controllers/CompaniesController.cs - Companies API → Company service: calls service
CompanyEmployees.Presentation/Controllers/CompaniesController.cs - Companies API → Deletion notification: publishes event
CompanyEmployees.Presentation/Controllers/CompaniesController.cs - API caller → Employees API: requests
CompanyEmployees.Presentation/Controllers/EmployeesController.cs - Employees API → Employee service: calls service
CompanyEmployees.Presentation/Controllers/EmployeesController.cs - Employee service → Repository manager: uses repositories
Service/EmployeeService.cs - Service manager → Company service: creates service
Service/ServiceManager.cs - Service manager → Employee service: creates service
Service/ServiceManager.cs - Service manager → API authentication: creates service
Service/ServiceManager.cs - Repository manager → Company repository: creates repository
Repository/RepositoryManager.cs - Repository manager → Employee repository: creates repository
Repository/RepositoryManager.cs - Repository manager → Application database: saves changes
Repository/RepositoryManager.cs - Employee repository → Application database: uses context
- Company repository → Application database: uses context
- Browser user → Web client: uses
- Web client → Companies API: requests data
- Browser user → Identity account: signs in
- Identity account → Identity user store: manages users
CompanyEmployees.IDP/Quickstart/Account/AccountController.cs - Identity account → Email delivery: sends email
CompanyEmployees.IDP/Quickstart/Account/AccountController.cs