Dapper is a simple object mapper for .NET and own the title of King of Micro ORM in terms of speed and is virtually as fast as using a raw ADO.NET data reader. An ORM is an Object Relational Mapper, which is responsible for mapping between database and programming language.
Dapper extend the IDbConnection by providing useful extension methods to query your database.
How Dapper Works?
It is a three step process.
- Create an IDbConnection object.
- Write a query to perform CRUD operations.
- Pass query as a parameter in Execute method.
Dapper is installed through NuGet: https://www.nuget.org/packages/Dapper
PM> Install-Package Dapper
Dapper work with any database provider since there is no DB specific implementation.
Dapper will extend your IDbConnection interface with multiple methods:
Execute and queries method can use parameters from multiple different ways:
The result returned by queries method can be mapped to multiple types:
- Strongly Typed
- Stored Procedure