techstack.sh techstack .sh

Guides

Best ORM for .NET in 2026

The best ORM for .NET in 2026 depends on how much SQL control your team needs and whether you want a full entity tracking model or a lighter query mapping layer. The main options are EF Core, Dapper, NHibernate, and Marten.

Short answer

EF Core is the best ORM for most .NET teams in 2026. It is maintained by Microsoft, has mature migration tooling, and covers the full ORM feature set with LINQ queries, change tracking, and both code-first and database-first workflows. Dapper is the right complement when raw performance on read-heavy paths matters more than abstraction. NHibernate is a valid choice for existing enterprise codebases but not the recommended default for new projects.

Comparison Table

Tool Query style Migrations Performance profile Best for Main tradeoff
EF Core LINQ-based ORM with change tracking, lazy/eager loading, and raw SQL escape hatches Code-first and database-first, both mature — dotnet ef migrations add Strong when projections and AsNoTracking() are used; heavier if full entity graphs are loaded unnecessarily ASP.NET applications, internal platforms, REST APIs, enterprise .NET services Change tracking overhead and LINQ query translation can surprise teams that do not tune reads carefully
Dapper Micro-ORM — maps raw SQL results to objects with minimal abstraction No built-in migration system; teams pair it with Fluent Migrator, DbUp, or raw SQL scripts Excellent — among the fastest .NET data access options because it maps SQL directly with no tracking overhead Performance-critical read paths, reporting queries, services where SQL control matters more than model abstraction No migration tooling, no change tracking, no relationship navigation — you write all SQL by hand
NHibernate Full ORM with mapping files or Fluent NHibernate, HQL, LINQ provider, and criteria API No built-in migrations; pairs with FluentMigrator or manual schema management Good when fetch strategies and caching are configured correctly; heavy when misused Existing NHibernate codebases, teams migrating from Java Hibernate, complex domain models in .NET Steeper learning curve than EF Core, larger configuration burden, and less active community momentum in 2026
Marten Document database ORM and event store on top of PostgreSQL — LINQ queries over JSON documents Auto-generates PostgreSQL schema from document type definitions Very strong for document-heavy workloads on PostgreSQL; not suitable for traditional relational modeling .NET teams building event-sourced systems, document stores, or CQRS architectures on PostgreSQL PostgreSQL-only; not a substitute for EF Core or Dapper when working with relational schemas across databases

1. EF Core

EF Core is the default ORM for .NET in 2026 and the right starting point for almost every new ASP.NET project. Microsoft maintains it actively, and its LINQ query interface is expressive, strongly typed, and generates reasonable SQL for most application workloads.

The feature that sets EF Core apart from Dapper is change tracking. When you load an entity, modify its properties, and call SaveChangesAsync(), EF Core computes the delta and generates the correct UPDATE statement automatically. For CRUD-heavy applications, this dramatically reduces boilerplate. For read-heavy workloads, always use AsNoTracking() to avoid the tracking overhead.

EF Core migrations are one of its strongest features. Code-first migrations let you evolve the database schema through C# entity changes, with a full history of migration files that can be reviewed, rolled back, and applied in CI/CD pipelines. Database-first scaffolding is also available for teams working with an existing schema.

2. Dapper

Dapper is a micro-ORM. It does one thing well: execute SQL and map the results to C# objects with minimal overhead. There is no change tracking, no LINQ query translation, and no migration system. You write SQL, Dapper runs it, and you get strongly-typed results back.

The performance advantage is significant. Because Dapper skips the ORM abstraction layer, it is among the fastest .NET database access options available. Stack Overflow has used Dapper at scale for years, which gives teams confidence in its production reliability.

The most common production pattern is using both EF Core and Dapper in the same application: EF Core handles entity-driven writes and simple reads, while Dapper handles reporting queries, bulk reads, and any SQL that benefits from being written explicitly. This is not a code smell — it is a pragmatic approach that the .NET community widely accepts.

3. NHibernate

NHibernate is the .NET port of Hibernate and has been used in large enterprise .NET applications for over a decade. It supports HQL, a LINQ provider, and a criteria API with extensive mapping configuration through XML files or Fluent NHibernate.

For greenfield .NET projects in 2026, NHibernate is not the recommended choice. EF Core has caught up in feature depth, has better tooling integration, and has far more active community resources. Where NHibernate still wins is in existing enterprise codebases with years of NHibernate investment — migrating away from it rarely justifies the cost.

4. Marten

Marten is a specialized library that uses PostgreSQL as a document database and event store. It lets .NET applications store C# objects as JSON documents and query them with LINQ, while also providing a first-class event sourcing and CQRS infrastructure.

It is not a substitute for EF Core or Dapper in traditional relational workloads. But for teams building event-sourced systems on PostgreSQL, Marten is one of the most complete and production-ready options in the .NET ecosystem.

FAQ

What is the best ORM for .NET in 2026?

EF Core is the best ORM for most .NET teams in 2026. It is actively maintained by Microsoft, has mature code-first and database-first migration workflows, and integrates deeply with ASP.NET Core. For teams that need maximum query performance and are comfortable writing SQL, Dapper is a strong complement or alternative for read-heavy paths.

Should I use EF Core or Dapper?

Use EF Core when you want a full ORM with entity tracking, relationship navigation, and a code-first migration workflow. Use Dapper when performance is the top priority and you prefer to write SQL directly. Many production .NET applications use both: EF Core for most application CRUD and Dapper for reporting, bulk reads, or highly optimized queries.

Is NHibernate still relevant in 2026?

NHibernate is still maintained and works well for teams that already have large codebases built on it. For greenfield .NET projects in 2026, EF Core is almost always the better starting point — it has more active community development, better tooling integration, and a lower configuration burden. NHibernate makes most sense for teams migrating from Java Hibernate or maintaining existing .NET enterprise applications.

How do EF Core migrations work?

EF Core uses code-first migrations generated via the dotnet ef migrations add command. You model your database schema through C# entity classes and DbContext, then EF Core generates migration files that track schema changes over time. These can be applied with dotnet ef database update or via programmatic migration on application startup. Database-first workflows — generating entity classes from an existing schema — are also supported.

What is the fastest ORM for .NET?

Dapper is consistently the fastest .NET data access library in benchmarks because it does minimal work beyond SQL execution and object mapping. EF Core with AsNoTracking() and explicit column projections performs very close to Dapper for read operations. For write operations, EF Core's change tracking adds overhead that is worth it for most applications but should be minimized in batch write scenarios using ExecuteUpdate or raw SQL.

Can I use EF Core with PostgreSQL?

Yes. EF Core has a mature PostgreSQL provider via Npgsql.EntityFrameworkCore.PostgreSQL. It supports PostgreSQL-specific types, full-text search, JSON columns, and most other PostgreSQL features. EF Core with PostgreSQL is one of the most common production .NET data stacks in 2026.

Related pages