If Entity Framework can execute raw SQL, why does Dapper still exist?
.NET Architect with 20+ years of experience building scalable, high-performance systems using C#, .NET, and modern cloud-native architectures. Focused on clean architecture, microservices, and pragmatic engineering decisions that balance productivity, maintainability, and performance. Passionate about modern data access patterns (EF Core, Dapper, CQRS) and building systems that scale in real-world production environments.

It's a valid question.
Modern EF Core is a powerhouse:
✅ LINQ Queries
✅ Raw SQL Execution (FromSqlRaw)
✅ Compiled Queries
✅ Batch Updates
✅ Change Tracking
✅ Migrations
✅ Relationship Management
So why do many experienced .NET developers still bring Dapper into their architectures?
The answer isn't simply "performance."
The real difference is:
Who manages complexity: the framework or the developer?
🔹 Entity Framework Core: The Domain Manager
Entity Framework isn't just a query builder.
It's a state management framework that implements many enterprise patterns out of the box.
When using EF Core, you're paying a small runtime cost in exchange for significant architectural benefits:
- Change Tracking
- Identity Resolution
- Relationship Management
- Optimistic Concurrency Control
- Unit of Work Behavior
- Automatic Query Parameterization
For example:
var users = await db.Users
.Where(u => u.Email == email)
.ToListAsync();
EF automatically generates parameterized SQL behind the scenes, helping reduce the risk of SQL injection vulnerabilities.
For many business applications, those guardrails are incredibly valuable.
EF Core optimizes for developer productivity, maintainability, and domain consistency.
🔹 Dapper: Closer to the Metal
Dapper takes a different approach.
It doesn't manage your domain state.
It doesn't track entities.
It doesn't maintain object graphs.
Instead, it focuses on one thing:
Executing SQL with minimal overhead.
var sql = "SELECT * FROM Users WHERE Email = @Email";
var users = await connection.QueryAsync<User>(
sql,
new { Email = email });
Dapper supports parameterized queries and can be just as secure as EF.
The difference is that the responsibility is more explicit because you're working closer to the SQL layer.
Its strengths include:
- Zero Change Tracking
- Minimal Memory Overhead
- Predictable Query Execution
- Fine-Grained SQL Control
- Excellent DTO Mapping
Dapper optimizes for query control and read performance.
⚙️ Where Many Enterprise Systems Eventually End Up
After more than 20 years building software, I've found that the "EF vs Dapper" debate often solves the wrong problem.
High-performance systems rarely choose one exclusively.
They naturally evolve toward a CQRS-style architecture.
Commands (Writes) → EF Core
Use EF when:
✔ Applying business rules
✔ Managing aggregates
✔ Maintaining transactional consistency
✔ Updating complex object graphs
Queries (Reads) → Dapper
Use Dapper when:
✔ Building dashboards
✔ Running reports
✔ Querying large datasets
✔ Serving high-throughput APIs
✔ Reading from replicas
Different workloads.
Different optimization goals.
Different tools.
A Thought Worth Considering
Most EF vs Dapper discussions focus on benchmark charts.
But the biggest costs in software are rarely measured in milliseconds.
They're measured in:
- Security incidents
- Maintenance effort
- Developer onboarding
- Feature delivery speed
- Long-term operational complexity
The performance difference between EF and Dapper is often measured in milliseconds.
The cost of choosing the wrong abstraction can be measured in years.
My Rule of Thumb
👉 If you're primarily solving business problems, start with EF Core.
👉 If you've identified a proven read-performance bottleneck, consider Dapper.
👉 If your system is growing into a serious enterprise platform, you'll likely end up using both.
Entity Framework optimizes developer productivity.
Dapper optimizes query control.
Architecture is deciding which optimization matters most for a given workload.
The best architects aren't loyal to ORMs.
They're loyal to outcomes.
How are you handling data access in your current systems?
1️⃣ EF Core only
2️⃣ Dapper only
3️⃣ Hybrid (EF + Dapper)
4️⃣ Full CQRS
#dotnet #csharp #entityframework #dapper #softwarearchitecture #backenddevelopment #aspnetcore #microservices #cqrs #cleanarchitecture #softwareengineering #developers