Chapter 8: Interacting with the Database with Dapper
It's time to start working on the backend of our Q&A app. In this chapter, we are going to build the database for the app and interact with it from ASP.NET Core with a library called Dapper.
We'll start by understanding what Dapper is and the benefits it brings over the Entity Framework. We'll create the data access layer in our app by learning how to read data from the database into model classes using Dapper. We'll then move on to writing data to the database from model classes.
Deploying database changes during releases of our app is an important and non-trivial task. So, we'll set up the management of database migrations using a library called DbUp
toward the end of this chapter.Â
In this chapter, we'll cover the following topics:
- Implementing the database
- Understanding what Dapper is and its benefits
- Installing and configuring Dapper
- Reading data...