How mehrdadbahrainy/daprepo works
DapRepo is a Dapper-backed generic repository and unit-of-work library. An application creates a unit of work, obtains an entity repository, and performs CRUD or paged reads; the repository issues SQL through Dapper on the unit of work’s connection. The unit of work opens and disposes that connection and optionally manages a TransactionScope. The sample documents a Person model and SQL table. The sample’s Program and repository wiring are inferred from the README; their source was not sampled.
Main entry points: UnitOfWork.cs Unit of Work · AppUnitOfWork.cs Sample Unit of Work · Person.cs Person Model · GenericRepository.cs Generic Repository
Components 16
Unit of Work
- Unit of Work API
src/DapRepo.DataAccess/IUnitOfWork.cs - Unit of Work
src/DapRepo.DataAccess/UnitOfWork.cs - Transaction Scope
Repository Layer
- Repository API
src/DapRepo.DataAccess/IGenericRepository.cs - Generic Repository
src/DapRepo.DataAccess/GenericRepository.cs - Key Attribute
src/DapRepo.DataAccess/KeyAttribute.cs - Ignore Attribute
src/DapRepo.DataAccess/IgnoreAttribute.cs - Not Generated
src/DapRepo.DataAccess/NotDbGeneratedAttribute.cs
Person Sample
- Person Repository
sample/DapRepo.Sample/DapRepo.Sample/Repositories/PersonRepository.cs - Sample Unit of Work
sample/DapRepo.Sample/DapRepo.Sample/AppUnitOfWork.cs - Person Model
sample/DapRepo.Sample/DapRepo.Sample/Models/Person.cs - Person Table
sample/DapRepo.Sample/DapRepo.Sample.Database/dbo/Tables/Person.sql
Other components
- Application
- Database Connection
- Dapper
- SQL Database
Connections 17
- Application → Sample Unit of Work: creates
- Sample Unit of Work → Unit of Work: extends
- Sample Unit of Work → Database Connection: creates
- Unit of Work → Database Connection: opens, disposes
- Unit of Work → Transaction Scope: manages optionally
- Sample Unit of Work → Person Repository: creates
- Person Repository → Generic Repository: extends
- Generic Repository → Repository API: implements
- Generic Repository → Dapper: queries, executes
- Dapper → Database Connection: uses
- Dapper → SQL Database: executes SQL
- Person Repository → Person Model: uses
- Person Table → SQL Database: defines table
- Person Model → Key Attribute: marks key
- Person Model → Ignore Attribute: marks ignored field
- Person Model → Not Generated: marks key behavior
- Unit of Work → Unit of Work API: implements