Dapper is an open source, lightweight “micro ORM” that supports many databases including SQL Server, MySQL, SQLite, SQL CE, and Firebird. By using Dapper in your applications you can simplify data access while ensuring high performance. In previous articles here I provided an introduction to Dapper and examined the Dapper Extensions Library.
In this article I will show how Dapper’s support for asynchronous operations can be leveraged in ASP.Net Core.
Create a new ASP.Net Core Web API project
First off, let’s create an ASP.Net Core project and install the necessary packages. Assuming that Visual Studio 2017 is up and running in your system, follow the steps outlined below to create an ASP.Net Core Web API project.
- Launch the Visual Studio 2017 IDE.
- Click on File > New > Project.
- Select “ASP.Net Core Web Application (.Net Core)” from the list of templates displayed.
- Specify a name for the project.
- Click OK to save the project.
- Select “API” in the “New .Net Core Web Application…” window.
- Select the version of ASP.Net Core you would like to use from the drop-down list at the top.
- Uncheck the “Enable Docker Support” and select “No Authentication” as we won’t be using either of these features here.
- Click OK.