Entity Framework has come a long way since version 1. So much that it leapfrogged every other version up to version 7.
With EF Core 2 out, I feel this gives us the performance and versatility we need for faster data access.
Keep in mind, I’m not saying all of these are recommended, I’m merely including them as top ORMs I’ve found in the .NET community as possible replacements for EF.
Dapper was built by the StackExchange group. This ORM delivers amazing results since it leverages ADO.NET.
To give you an idea of the performance, Matthew Jones from ExceptionNotFound.net conducted a performance benchmark between Dapper, Entity Framework, and ADO.NET. His benchmark shows Dapper delivering exceptional performance over Entity Framework and narrowly edges out even ADO.NET.
While the performance is worthy, the technique of getting the data reminds me of the old days of retrieving data.
Here is a code example from their GitHub page:
As you can see, it uses inline SQL to pull back the record and map it. The only thing missing is the left-to-right assignment.
Their GitHub page has a lot of examples like this.
nHibernate (introduced in 2007) is one of the oldest and most stable ORMs around and has been around longer than Entity Framework (introduced in 2008).
Most companies run their entire data access on NHibernate and are one of the most stable ORM frameworks around.
I’ve heard tales of woe and tales of wonder with this product. It has a number of ways to configure your mappings whether it be in code or through XML.
While I’ve never worked with the product, it’s definitely vast in its configuration settings making it quite versatile.
Replacing the SQL statements with LINQ makes this example better in my opinion.
Why just two?
When examining the landscape of ORMs, I referred to a wiki page listing of object-relational mapping software for.NET.
Now, I don’t want to alarm anyone, but after looking through this list of ORMs, I realized that 75% of them were names I’ve never heard of, don’t exist, or aren’t active.
I tried to remember some ORMs my colleagues used in the past. I remember the majority mentioning Entity Framework and NHibernate as their tool of choice with Dapper being the new guy on the block. In that order.
Even though Dapper is new, I couldn’t find any other mature, solid, stable, or popular ORMs
Deependra is a Senior Developer with Microsoft technologies, currently working with Opteamix India business private solution. In My Free time, I write blogs and make technical youtube videos. Having the good understanding of Service-oriented architect, Designing microservices using domain driven design.