.NET 5.0 REST API boilerplate with Dapper for Database and JWT bearer authentication and role based authorization
- Visual Studio 2019 Version 16.8.1
- .NET 5.0 SDK
- MySQL or MSSQL Server or PostgreSQL
- I am using Dapper and Dapper.Contrib for database access.
- You can use MySQL, MSSQL Server and PostgreSQL on single application, you just need to specify the database server adapter
- Dapper.Contrib code: https://github.com/StackExchange/Dapper/blob/main/Dapper.Contrib/SqlMapperExtensions.cs
- MiniProfiler/dotnet#290
- https://stackoverflow.com/questions/50581540/dapper-contrib-and-miniprofiler-for-mysql-integration-issues?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
- See appsettings.js
"DatabaseSettings": {
"Main": {
"ConnectionString": "Server=127.0.0.1; Port=3306;Database=APINETCORESample;User Id=root;password=;Persist Security Info=True;Allow Zero Datetime=True;CharSet=utf8;",
"Adapter": "mysqlconnection"
},
"OtherDBServer": {
"ConnectionString": "",
"Adapter": "mysqlconnection" // list: API-DataAccess/SettingModel/Enums.Adapter
}
},