FeaturedIT topics

How to use Dapper in ASP.Net Core

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.

  1. Launch the Visual Studio 2017 IDE.
  2. Click on File > New > Project.
  3. Select “ASP.Net Core Web Application (.Net Core)” from the list of templates displayed.
  4. Specify a name for the project.
  5. Click OK to save the project.
  6. Select “API” in the “New .Net Core Web Application…” window.
  7. Select the version of ASP.Net Core you would like to use from the drop-down list at the top.
  8. Uncheck the “Enable Docker Support” and select “No Authentication” as we won’t be using either of these features here.
  9. Click OK.

Related Articles

Back to top button