I am trying to implement identity auth to my project but it's not creating an applicationdb class like it used to. I am new to coding so I am sorry if it looks dumb
I was expecting to get the db class like it used to create before
I am trying to implement identity auth to my project but it's not creating an applicationdb class like it used to. I am new to coding so I am sorry if it looks dumb
I was expecting to get the db class like it used to create before
Copyright © 2021 Jogjafile Inc.
You haven't specified, which version of .NET you are using. However, in latest version or in .NET 8 Microsoft has moved away from a single pre-defined
ApplicationDbContextclass. Instead, it encourages developers to define their own DbContext while adding the Identity scaffholding.You can define your own ApplicationDbContext by yourself before adding Identity or at the same time while adding identity within your project.
So, while you would click for adding Identity within your project, it would give you the option for DbContext configuration.
You can do as following:
Or you can create manually as following:
Output:
After successfull creation, you should have following output:
Note: Make sure, that you have the necessary NuGet packages installed for Identity. In ASP.NET Core 8, you typically need
Microsoft.AspNetCore.Identity.EntityFrameworkCorepackage. Please refer to this official document, if you want to study more.