Petr Volobuev | Technology RadarPetr Volobuev | Technology Radar
Using

Tested the .NET 5 version of Dapper on a small task. Still wonderful. But using it still requires seriously leveling up the team's SQL skills. That's not an option right now. So it stays reserved for the odd small things I build with my own hands.

Using

Turns out queries via Dapper are so fast that our integrations shoveling large volumes of data sped up by two orders of magnitude after swapping linq-to-sql for Dapper. Sure, we also cleaned the code of unnecessary valuetype copies and boxing along the way, but the impact is obvious either way.

Assessing

Dapper is a micro-ORM that lets you write raw TSQL queries directly and map the results onto your own models.

My current database access stack is linq-to-db with a db first approach. Dapper also lets you go database-first, and if needed you can even do migrations with scripts — though it's trickier than with EF.

Trying it out feels really comfortable, although that might just be because I subjectively feel more in control when I write the queries myself — probably a habit left over from my php days of raw SQL.

Example query

using (var conn = new SqlConnection("ConnectionString")){
    var divisions = conn.Query<DivisionDAL>("select * from Divisions where area = @area", new { area });
}

Worth noting: the library protects you from injections and other nastiness on its own — as long as you use it exactly the way the authors intended.