Create the Project
Start a New Minimal API Project
Open rider and select New Solution
Enter CrudApp as the solution name
Enter CrudAppAPI as the project name
Choose the solution directory
Uncheck put solution and project in the same directory
Choose whether to create a Git repository
Select template Web API and press create
Open the Program.cs file and delete the comments, example endpoint along with its variable and record. You should then be left with a clean empty project
Install the Required Nuget Packages
We will need to add nuget packages to use the methods required to connect to our SQL database. We will also use Dapper to simplify our database access and FluentValidation to validate incoming data.
Open the NuGet package manager and search for the following and add them to the project:
Dapper FluentValidation FluentValidation.AspNetCore FluentValidation.DependencyInjectionExtensions Microsoft.Data.SqlClient
Add a Connection String
To connect to our database, we will need to add a connection string with the required details.
Add the connection string to the appsettings.Development.json file