Micro ORMs

From ADO.NET to EF

When I started to learn to programming I didn’t have knowledge about ORMs. I feel that is the pain in the ass writing all that SQL code, and then I discovered Linq to SQL.

I remember that I was totally in love in that. I wrote a lot off code with it (mostly a bad code 🙂 ).Then I started using EntityFramework

Then I started using EntityFramework. At the begging with database first convention, and then with code first convention.

Slowly I started to discovering weak points of ORMs, like performance, a lot of unneeded data, at sometimes to archive what expected SQL code there was need to spend a lot of time or just write SQL View.

Micro ORMs

Then I discovered micro ORMs. First I used was Massive.

Massive is so small library that even doesn’t have nuget package, it is just a one small code file.


In my current work, I have an opportunity to work with Simple.Data. At the beginning I was very happy using it, it seems relly easy to learn and use, but when I wanted to do something more complicated, like filter records by data from a foreign table, the code began to complicate very fast.

Last thing that finally made me very angry it was its performance in casting to objects. I had to fetch relatively a big chunk of data, over 6k rows because of left joins, and that 6k records should give me 700 objects. I understand that it is not a standard use case, and maybe I made some mistake, maybe there is a way how to do that better, but I didn’t find it. Simple.Data is no longer supported and that thing also didn’t help me to find an answer.


So I made the decision that I have to change Simple.Data to something else. After a short research, I found Dapper.

Dapper, it is an open source project made by StackExchange. They claimed that almost entire data access layer is made with Dapper.

Using Dapper you have to write SQL code by yourself, so thanks to that you have 100% control over it, and at the end, it is more like a data caster, but really good data caster.
StackExchange also developed SqlQueryBuilder, which simplifies creating SQL query a lot.

So to summarize, if you looking for small versatile and supported ORM, you should look at Dapper.

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *