Why every .NET Developer should know about Dapper Plus

Every .NET web application must use database for data persistence. And to make work easier, almost every project goes with Entity Framework Core as default ORM.
Then, at some point, you need faster data access, and EF don't fit the need. What are the next steps?

When I occur this case, I go with Dapper.
And image bellow shows performance benefits on a local database with 50k records.

While excellent for queries and basic CRUD operations, Dapper lacks native support for bulk operations, making its performance for inserting or updating large datasets significantly slower than that of EF Core.

Fortunately, there is a fix to this problem. It's called Dapper Plus.

What is Dapper Plus?

Dapper Plus is also micro ORM that makes bulk operations piece of cake.
It can be use with or without Dapper and the methods at your disposal are:

This is all you need to know for now, because code will tell the rest. So let's begin.

Prerequisites

To be able to follow along, you need few things:

  • Preferred IDE(Visual Studio or Rider)
  • SQL Server

Or if you prefer lighter version, you can go with .NET Fiddle.

Dapper plus in action

When I think about real word example fit for this methods, first thing that comes to my mind is - "Synchronization" service.
So we will build CRUD REST API that will deal with logs from different services and persisted them in database