A step-by-step guide to building an ASP.NET Core 3.0 React single-page application with MySQL and ASP.NET Identity.
This tutorial uses .NET Core 3.0. Also proven to work on .NET Core 3.1 as well!
The web app has React as front end, MySQL as Database layer where the ASP.NET Identity Server 4 membership related schema will be migrated to.
Detailed Article: bit.ly/2zPN385
Full Code on Github Repo : bit.ly/2LWgacA
Introduction
Create ASP.NET Core ]Project
Configure Project creation with React & Authentication
Delete MSSQL Server Database Migrations Directory
Uninstall Microsoft.EntityFrameworkCore.SQLServer
Install Pomelo.EntityFrameworkCore.MySql
Update all NuGet package dependencies
Update appsettings.json Connection String for MySQL database
Update Startup.CS file to use to MySQL
Build the solution
Pre-checks before creating migrations or MySQL
Add Migration to create Membership Schema scripts for MySQL
Update Database to have ASP.NET Core Membership tables in MySQL
Verify MySQL database for membership tables
Run the application
Register user and login to application
Verify for Registered User in MySQL database
Summary
Pre-Requisites
Microsoft Visual Studio 2019 Community Edition
.net core 3 dotnet.microsoft.com/download/dotnet-core
MySQL Tools for Visutal Studio dev.mysql.com/downloads/windows/visualstudio/
mysql-for-visualstudio-1.2.9.msi (dev.mysql.com/downloads/windows/visualstudio/)
Configurating ASP.NET Membership web app for MySQL
Step 1:
Delete Migrations Directory under the Data Directory
Step 2:
Uninstall the package Microsoft.EntityFrameworkCore.SQLServer Install the package Pomelo.EntityFrameworkCore.MySql
Step 3:
Create db in MySql
CREATE SCHEMA reactmembership;
Step 4:
Update value of DefaultConnection in appsettings.json to
server=localhost;port=3306;database=reactmembership;user=root;password=p@$$w0Rd;CharSet=utf8
Step 5:
In Startup.cs file update ConfigureServices method to replace UseSqlServer with UseMySql
Step 6:
Tools -~ Nuget Package Manager -~ Package Manager Console
In Visual Studio, use the Package Manager Console to scaffold a new migration and apply it to the database:
Add-Migration [migration name]
Update-Database
#dotnetcore3 #mysql #IdentityServer4 #aspnet #dotnet #reactjs #authentication #mysqlauthentication
------------------------------------------------------------------------------------------------
🆂🆄🅱🆂🅲🆁🅸🅱🅴 to 🆃🆄🆃🅻🅸🅽🅺🆂 channel if you like the content.
🆂🆄🅱🆂🅲🆁🅸🅱🅴: bit.ly/2Y0ZunB
Share this video with your friends and colleagues and let them know you are upto date with latest tech-trends
Follow us:
Facebook: bit.ly/2Djmd6l
Twitter: bit.ly/2Ol9ZQT
Instagram: bit.ly/2pV4cYY
Support:
(Appreciate your Generosity: 💸)
PayPal: bit.ly/2NZgVma
ETH: 0x0689Ecd747d6F4eA9CE491aD0b1734fEe62b2229
Why it's here
2 people recommend this
What people say. Shared as a tutorial for integrating databases like MySQL or PostgreSQL with Entity Framework Core.
n
u/navulepavanin r/dotnet • Recommends
On “MySQL or PostgreSQL with Entity Framework Core ?”
Both are okay. But it all depends on the amounts of data you have. If you deal with hundreds of millions of records or have geo-spatial data or time series data you can go for PostgreSQL.
Otherwise you can go for MySQL.
NpgSql.EntityFrameworkCore.PgSql is the pacakage for you to work with Entity Framework core. If you want to see a tutorial you can check this link to this video for integrating PostgreSQL with .net Core 3.1.
For MySQL to work with Entity Framework Core, Pomelo.EntityFrameworkCore.MySql package does the job. This tutorial will help you set up Pomelo.EntityFrameworkCore.MySql for your ASP.Net Core 3.1 web app.