.Net 5 Identity using MySQL in MVC projects

  Рет қаралды 4,209

Data Vids (Data Vids)

Data Vids (Data Vids)

Күн бұрын

Setting up Identity to use MySQL or MariaDB requires just a few additional steps. Follow along in your Visual Studio to quickly get setup with a MVC login system that uses MySQL (or MariaDB) instead of SQL server as the backend.

Пікірлер: 29
@DataVids
@DataVids 3 жыл бұрын
A couple of good links to read as next steps (watch this video first as a pre-requisite and to get authentication done before doing anything with authorization, so you can get your initial project setup...) - Customize your identity: docs.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-6.0 Then, add either role based authorization: docs.microsoft.com/en-us/aspnet/core/security/authorization/roles?view=aspnetcore-6.0 or claims based authorization: docs.microsoft.com/en-us/aspnet/core/security/authorization/claims?view=aspnetcore-6.0
@lightbringer4352
@lightbringer4352 2 жыл бұрын
Thank you again.
@DataVids
@DataVids 2 жыл бұрын
my pleasure! thank you so much!!
@jaspercoleman3269
@jaspercoleman3269 2 жыл бұрын
Thanks for the video! I needed a way to do more of my DotNet development on my M1 Macs, and this completed the gap of what I was missing.
@DataVids
@DataVids 2 жыл бұрын
You're welcome!
@MichaelFurmedge
@MichaelFurmedge 3 жыл бұрын
This is spooky, I was literally thinking about this yesterday and wondering if there was a cheaper option than SQL Server for making personal projects. Thanks for making the video :)
@DataVids
@DataVids 3 жыл бұрын
You know that's what got me onto the topic, a few times I have dug into this with the idea of saving money on personal projects. Bright minds think alike, @Michael Furmedge.
@thecyberhelp1
@thecyberhelp1 Жыл бұрын
Thanks bro love from India
@DaveNorthWest
@DaveNorthWest 2 ай бұрын
Cool! Thanks! This basically converted the entity to use MySQL rather than MSSQL. Thanks for making this great video! Btw it works with all the other packages being version 8.0.11 now and adding the pomelo.entityframworkcore.mysql version 8.0.2. Its almost year 2025 now as of posing this comment
@lightbringer4352
@lightbringer4352 2 жыл бұрын
You saved my day, thank you so much
@DataVids
@DataVids 2 жыл бұрын
So glad I could help! Have a great day.
@deepakdutta2879
@deepakdutta2879 9 ай бұрын
Can we do without _migration table and entity validation? I have old apps that need to be updated but I don't have migration table and the fails with error that cannot validate the model because no migrations history found.
@MikeJones-gt8ke
@MikeJones-gt8ke 2 жыл бұрын
Thanks, this was exactly what I needed!
@DataVids
@DataVids 2 жыл бұрын
Best news today!
@jemschaudhary5922
@jemschaudhary5922 2 жыл бұрын
Sorry one more request from me: (mysql) Most of the times we want to change the PK of aspnetusers table to email (for example), and then use it as FK in other tables. I remember the conflict of that PK FK changes in other asp.net identity generated tables (aspnetroles, aspnetclaims,...). Can you please provide a solution how to change the PK and handle FK constraint in all identity tables?
@DataVids
@DataVids Жыл бұрын
Hm, I might need a bit more information to assist on this one. However, the primary key on aspnetusers for you is 'Id' right? And is the reason you want to change that key because you want to make a complex key to ensure it is unique or for reporting? If this is the case I would think you could just add a constraint to keep it unique instead of changing the primary key. Or are you maybe trying to make an auto increment ID? The thing about identity is its going to generate that value for you. If its a foreign key constraint error, that is something different: that means that you might have data in a table that doesn't have a matching value in the table that is linked by foreign key. There are other foreign key errors, workbench usually avoids them if you use their 'sometimes functional' UI, but here is an interesting article: www.cockroachlabs.com/blog/common-foreign-key-mistakes/
@jemschaudhary5922
@jemschaudhary5922 Жыл бұрын
@@DataVids Thanks for amazing explanation. I has other tables which can use 'email' as FK. I can you use userid as FK in other tables to totally skip that confusion. But was looking for sweet solution for that issue. Thanks again!
@jemschaudhary5922
@jemschaudhary5922 2 жыл бұрын
If you have not created any video on identity - 'Roles', Can you make one on covering that topic (with mysql db)? How to set up roles and how to works and any possible problems in the way? Thanks in advance!
@DataVids
@DataVids Жыл бұрын
Yes I will add identity-roles to the list, but it might be a while before I get to that one. Hopefully you are in dotnet 6 or 7, here is a interesting read: learn.microsoft.com/en-us/aspnet/core/security/authorization/roles?view=aspnetcore-7.0
@jemschaudhary5922
@jemschaudhary5922 Жыл бұрын
@@DataVids Thanks for that!
@jemschaudhary5922
@jemschaudhary5922 2 жыл бұрын
Great video. Thanks! Are there any problems in future if using mysql database and asp.net 'identity system'? Or it works similar without any problems with sql or mysql after those steps above?
@DataVids
@DataVids Жыл бұрын
I think you are fine to use MySQL. The last time I did that I used Pomelo.EntityFrameworkCore.MySql as the provider.
@jemschaudhary5922
@jemschaudhary5922 Жыл бұрын
@@DataVids Okay! Thanks :)
@Пек-б5б
@Пек-б5б 2 жыл бұрын
Thanks for the video!
@DataVids
@DataVids 2 жыл бұрын
You're welcome!
@wcameros1
@wcameros1 2 жыл бұрын
Me has ayudado mucho, en mi proyecto. Gracias, Gracias...
@DataVids
@DataVids 2 жыл бұрын
Very glad to have helped! Thanks for watching
@spiedey8
@spiedey8 2 жыл бұрын
Thanks for the info!
@DataVids
@DataVids 2 жыл бұрын
You bet!
Use MySQL With .NET Core and Entity Framework
19:08
Geekinsta
Рет қаралды 20 М.
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
Какой я клей? | CLEX #shorts
0:59
CLEX
Рет қаралды 1,9 МЛН
ASP.NET MVC 5 & Identity : User Authentication
15:14
Dev Monsters - Haytham ben slimane
Рет қаралды 18 М.
CREATE and CONNECT DATABASES in ASP.NET
18:11
tutorialsEU - C#
Рет қаралды 76 М.
Simon Sinek's Advice Will Leave You SPEECHLESS 2.0 (MUST WATCH)
20:43
Alpha Leaders
Рет қаралды 2,6 МЛН
Ajax calls to .Net5 MVC Controllers (using JQuery)
12:07
Data Vids (Data Vids)
Рет қаралды 14 М.
How to setup MySQL in ASP.NET 6 using Entity Framework
12:48
In-Memory Cache for ASP.NET MVC CORE (November 2020)
10:13
Data Vids (Data Vids)
Рет қаралды 8 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 97 М.
07 How to Migrate SQL Server database to MySQL
6:15
Learn SSIS
Рет қаралды 38 М.
Deploying DotNet Core to Linux | Blazor Deploy Linux
11:21
Coding Droplets
Рет қаралды 22 М.
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН