How cankutayucar/api-mvc works
This repository is a product-and-category API backed by a SQL Server data layer, with a separate, small MVC web application. The main workflow is an API request through a controller and product service, into repositories and the unit of work, with results mapped into response DTOs; product reads also use in-memory caching. Category and validation capabilities are represented from the tree and registration, though their source was not sampled. The README provides no further product detail.
Main entry points: ProductServiceWithCaching.cs Cached product service · AppDbContext.cs EF database context · ProductsController.cs Products controller · UnitOfWork.cs Unit of work
Components 19
API and validation
- Products controller
Architecture.API/Controllers/ProductsController.cs - Categories controller
Architecture.API/Controllers/CategoriesController.cs - Response formatting
Architecture.API/Controllers/CustomBaseController.cs - Request validation
Architecture.API/Filters/ValidateFilterAttribute.cs - Exception handling
Architecture.API/Middlewares/UseCustomExceptionHandler.cs
Application services
- Cached product service
Architecture.Caching/ProductServiceWithCaching.cs - Category service
Architecture.Service/Abstract/Services/CategoryService.cs - Generic service
Architecture.Service/Abstract/Services/Service.cs - DTO mapping
Architecture.Service/Mapper/MapProfile.cs - Product validator
Architecture.Service/Validators/ProductDtoValidator.cs
Persistence
- Product repository
Architecture.Repository/Concrete/Repositories/ProductRepository.cs - Category repository
Architecture.Repository/Concrete/Repositories/CategoryRepository.cs - Generic repository
Architecture.Repository/Concrete/Repositories/GenericRepository.cs - Unit of work
Architecture.Repository/Concrete/UnitOfWork/UnitOfWork.cs - EF database context
Architecture.Repository/AppDbContext.cs
MVC web
- Home controller
Architecture.Web/Controllers/HomeController.cs
Other components
- API client
- SQL Server
- Web visitor
Connections 23
- API client → Products controller: requests
- Products controller → Cached product service: calls
- Products controller → DTO mapping: maps DTOs
- Products controller → Response formatting: formats result
- API client → Categories controller: requests
- Categories controller → Category service: calls
- Categories controller → Response formatting: formats result
- Request validation → Product validator: validates with
- Cached product service → Product repository: queries and writes
- Cached product service → Unit of work: commits
- Cached product service → DTO mapping: maps results
- Cached product service → Category repository: queries related data
- Category service → Category repository: uses
- Category service → Unit of work: commits
- Generic service → Generic repository: uses
- Generic service → Unit of work: commits
- Product repository → EF database context: uses
- Category repository → EF database context: uses
- Generic repository → EF database context: queries and changes
- Unit of work → EF database context: commits
- EF database context → SQL Server: persists data
- Exception handling → API client: returns error
- Web visitor → Home controller: requests pages