The micro-ORM for high-performance queries
What is Dapper and when to use it instead of Entity Framework
Everything you need to know about Dapper: the micro-ORM for .NET that offers speed and total control over SQL queries.
Dapper is a micro-ORM for .NET developed by the Stack Overflow team, designed to offer extreme performance and total control over SQL queries.
Unlike Entity Framework which generates SQL automatically, Dapper lets you write your own SQL queries and automatically maps the results to C# objects.
If performance is your priority and you want full control over every query, Dapper is the right tool.
How Dapper works
Dapper is a set of extension methods on IDbConnection. It has no object model, doesn't track entities, doesn't generate SQL: it does one thing and does it perfectly, maps SQL results to C# objects.
Key features
| Feature | Description |
|---|---|
| Query | Executes a SQL query and maps the results to a list of typed objects. |
| Execute | Executes INSERT, UPDATE, DELETE and stored procedures with typed parameters. |
| Multi-mapping | Maps SQL joins to related C# objects in a single query. |
| Multi-result | Reads multiple results from a single query (QueryMultiple). |
| Native Async | QueryAsync, ExecuteAsync for non-blocking operations. |
| Typed parameters | Automatic SQL injection prevention with object parameters. |
Dapper is extremely fast because it has no overhead: no change tracking, no lazy loading, no SQL generation. Just pure mapping.
Dapper vs Entity Framework: when to use which
| Aspect | Dapper | Entity Framework Core |
|---|---|---|
| Performance | Near-native (few µs of overhead) | Good (with tracking overhead) |
| SQL | Written manually (full control) | Generated from LINQ (convenient) |
| Migrations | Not supported (use external tools) | Integrated with Code-First |
| Change tracking | No (faster) | Yes (more convenient for CRUD) |
| Learning curve | Minimal (know SQL, know Dapper) | Medium (LINQ, navigation, conventions) |
| Batch operations | Via direct SQL | ExecuteUpdate/ExecuteDelete (EF 7+) |
| Caching | To be implemented | Integrated query caching |
When to choose Dapper
- Complex queries with multiple joins where you want hand-optimized SQL
- Hot paths with strict latency requirements
- Read-heavy applications with existing stored procedures
- Lightweight microservices where EF overhead is not justified
When to choose Entity Framework
- Standard CRUD applications where productivity is the priority
- Projects that benefit from automatic migrations
- Teams that prefer LINQ to pure SQL
Advantages of Dapper
Unbeatable performance, Minimal overhead compared to pure ADO.NET. Used in production by Stack Overflow.
Simplicity, A single NuGet package, few methods, zero configuration. You learn it in an hour.
SQL control, Write exactly the query you want. No surprises in generated SQL.
Compatibility, Works with any database that supports ADO.NET: SQL Server, PostgreSQL, MySQL, SQLite.
Async-first, Full support for async/await on all operations.
Get started with Dapper: resources
Do you want to master data access in .NET?
Choose the right tool for every project
With our .NET course you'll learn Dapper, Entity Framework and best practices for managing data in enterprise applications.
Frequently asked questions
Dapper è un micro-ORM per .NET sviluppato dal team di Stack Overflow. Mappa i risultati delle query SQL su oggetti C# con performance vicine ad ADO.NET puro.
Sì, Dapper è completamente open-source e gratuito, disponibile come pacchetto NuGet. È uno dei micro-ORM più usati nell'ecosistema .NET.
Dapper richiede SQL manuale ma offre performance superiori. Entity Framework genera SQL da LINQ ed è più comodo per operazioni CRUD standard ma con overhead maggiore.
Usa Dapper quando le performance sono critiche, quando hai query complesse da ottimizzare a mano, o quando lavori con stored procedure e database legacy.
Il modo migliore è seguire un percorso strutturato con progetti pratici. Il nostro corso .NET include Dapper, Entity Framework e le best practice per la gestione dati.