Press "Enter" to skip to content

A Guide to Dapper

Camilo Reyes shows how to use Dapper:

Dapper is a lightweight shim around ADO.NET for data access via extension methods. To keep this relevant to any real application, there is quite a bit of code, which I won’t be able to show, so I recommend downloading the repo from GitHub. The focus here is to walk through the code API and follow best practices for building a DAL. The set of extension methods can feel overwhelming because there is a lot of functionality to cover.

I recommend general familiarity with LINQ and the List<> generic class in C#. This guide can be used as a reference so you can read one section at a time. At each pause, I encourage you to play with the code and allow the information to sink in.

I tend to like Dapper a lot, as it’s basically a lightweight wrapper around ADO. It’s very efficient as a result and you can also use stored procedures quite easily.