Personal / open-source project
NLayer API
An N-layer Web API with Unit of Work, a generic repository and a caching service layer.
01 · Goal
Set up error handling, validation and caching in the API tier in a consistent, reusable way.
02 · Structure
Core, Repository, Service, Caching and API projects. Global exception middleware, validation and not-found filters, a shared response DTO, and an alternative product service implementation backed by IMemoryCache.
03 · Highlights
- A central error response model
- Swapping in a cached service implementation via DI
04 · Takeaway
An example that brings together the building blocks of a layered API.