A .NET 10 tutorial project demonstrating how to use Dapper ORM with a clean layered architecture pattern.
This is a Unit Test project that demonstrates Dapper ORM methods using .NET 10 infrastructure. Northwind database is used as the sample database.
Note: On 16.02.2026, all projects were upgraded to .NET 10.
DapperCoreTutorial/
├── Models/ # Entity classes (Northwind entities)
│ ├── Product.cs
│ ├── Category.cs
│ ├── Order.cs
│ ├── OrderDetail.cs
│ └── IEntity.cs
├── DataAccess/ # Data access layer
│ ├── Abstract/
│ │ ├── IProductDal.cs
│ │ └── ICategoryDal.cs
│ ├── Concrete/Dapper/
│ │ ├── DapperProductDal.cs
│ │ └── DapperCategoryDal.cs
│ ├── DapperGenericRepository.cs
│ ├── IEntityRepository.cs
│ └── DbConnect.cs
├── Business/ # Business logic layer
│ ├── Abstract/
│ │ ├── IProductService.cs
│ │ └── ICategoryService.cs
│ ├── Concrete/
│ │ ├── ProductManager.cs
│ │ └── CategoryManager.cs
│ ├── QueryMethods.cs
│ ├── ExecuteMethods.cs
│ └── DapperAsyncMethods.cs
└── DapperORMUnitTest/ # Unit tests
└── DapperUnitTest.cs
- .NET 10
- Dapper - Micro ORM
- Dapper.Contrib.Extensions - CRUD extensions for Dapper
- System.Data.SqlClient - SQL Server connectivity
- Microsoft.Extensions.Configuration - Configuration management
| Layer | Description |
|---|---|
| DataAccess | Generic Repository pattern for Dapper. Dapper.Contrib NuGet package is used to design the generic repository easily. Abstract interfaces and Concrete classes are created for each entity. This design satisfies basic CRUD operations. |
| Business | Contains QueryMethods and ExecuteMethods class files which have Dapper's built-in Query and Execute methods respectively. Also includes DapperAsyncMethods file for asynchronous operations support. |
| Models | Contains entities compatible with the Northwind database (Products, Categories tables, etc.) |
IProductDal
DapperProductDal
-
Clone the repository:
git clone https://github.com/mertmtn/DapperCoreTutorial.git
-
Update the connection string in
DbConnect.csto point to your SQL Server instance with Northwind database. -
Build the solution:
dotnet build
-
Run the tests:
dotnet test
Dapper ORM'ine ait metotları barındıran unit test projesidir. .NET 10 alt yapısına sahiptir. Northwind veritabanı kullanılmıştır.
Not: 16.02.2026 tarihinde bütün projeler .NET 10'a yükseltildi.
| Katman | Açıklama |
|---|---|
| DataAccess | Dapper için GenericRepository tasarımı yapıldı. Her entity için Abstract interface ve Concrete sınıflar oluşturuldu. Dapper.Contrib nuget paketi kurularak metotları temel CRUD işlemleri için geliştirildi. |
| Business | QueryMethods ve ExecuteMethods dosyaları bulunur. Bu dosyalar sırasıyla Dapper'a ait Query ve Execute metodlarını barındırır. Ayrıca Asenkron işlemleri de desteklediği için DapperAsyncMethods dosyası da bulunur. |
| Models | Northwind'e uyumlu entityler mevcuttur (Products, Categories tabloları vs.) |
DapperUnitTest.cs'de örnek testleri bulabilirsiniz.
DataAccess projesinde Abstract interface'de oluşturulan metotlar, generic repository'deki ortak metotlara ek olarak oluşturulabilir.
This project is open source and available for learning purposes.
mertmtn - GitHub


