ORM Tools In .Net Core Step By Step.

Mevlüt Gür
3 min readMar 9, 2025

--

Hello,
Many of us use EF (entity framework) as an orm tool in their projects. I have only used EF throughout my entire work experience. I have recently become curious about how other tools work. So I immediately created a mini project and made basic examples of how each one works.

You can access the mini project I developed using Minimal Api on .Net Core 8 here.

I decided to write this article with my observations in this project and the information I gained about the tools.

ADO.NET

It is the most basic data access technology of .NET Framework and allows you to run SQL queries directly and process data manually. It is not an ORM tool. It works with objects such as connections, commands, readers and data sets.

Advantages:

Performance: It is one of the fastest methods because it does not include an ORM layer.

Control: You completely manage SQL queries and database operations.

No dependencies: It does not need extra libraries, it comes directly in .NET.

Disadvantages:

Code repetitions are high: Connections, command objects and return types must be written every time.

Manual mapping is required: You need to manually map the data returned from SQL queries to objects.

If you check out my repo on Github, I created a separate projects for each tool. I use an example entity called Movie for all.

I wanted to make the code a little cleaner by using the repository pattern. The code snippet for the Select and Add operations is below.

In order to perform our DB operations with AdoNet, a connection must be made and queries must be written manually. We really feel the advantages and disadvantages mentioned above.

I connected this tiny development to endpoints via the Minimal API.

DAPPER

Dapper is known as a micro ORM. It simplifies data mapping operations while preserving the performance advantages of ADO.NET.

Advantages:

Fast: It is very close to ADO.NET because ORM operations are minimal.

Easy-to-use SQL support: You can write SQL queries directly and map them to objects easily.

Low memory consumption: It is lightweight and performance-oriented.

Disadvantages:

Manual SQL writing is required: It requires a lot of SQL writing for complex queries.

It is not a full ORM: It does not support LINQ and does not have advanced object tracking mechanisms.

As can be seen in the sample code below, presenting the data as a model is a great advantage compared to AdoNet. However, fetching the data by writing SQL is a great difficulty.

Entity Framework

It is a full-featured ORM tool for .NET. It makes working with the database more object-oriented and enables writing queries with LINQ.

Advantages:

LINQ support: More readable code can be written using LINQ instead of SQL queries.

Automatic object mapping: Provides conversion between table and model classes.

Migration support: Can automatically create and update database schemas.

Disadvantages:

Performance loss: Slower than ADO.NET and Dapper.

More memory consumption: It can be difficult to manage, especially in large projects.

First we create the DbContext.

As can be seen in the sample code below, we can perform our DB operations in a practical way without writing SQL. However, it lags behind the others in terms of performance. This is actually a common practice in the software world, “If there is an advantage somewhere, there is another disadvantage”

I hope this article was useful for you. Don’t forget to review the project codes on Github. See you in another article… 🚀 🚀 🚀

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mevlüt Gür
Mevlüt Gür

No responses yet

Write a response