0
I am encountering a problem. Below I have performed the following steps:
1) I created an Asp.net core web Aplication MVC project without authentication (Asp.net core 2.2).
2) Because I already have a database, I used the Databasefirst schema, so a context was created automatically.
3) I then decided to add Asp.Net Core Identity to my project.
The problem is that I now have two Contexts, one for Identity and the other for my database. Only the database is unique, so I understand that there should be no two contexts.
How do I configure the two contexts in Statup.Cs with the same connection string?
Hugs
Hello, Rafael! Thank you so much for your feedback. If it’s no bother, you could give me a tip on how and where to create this Applicationuser class?
– Hugo
Hello Hugo, the Applicationuser class is just an example, you can create the class with the name you want, the important thing here is to inherit Identityuser and in Startup reference it so that EF Core can map it. This you do in services.Addidentity<Applicationuser>() and also in Identitydbcontext<Applicationuser> as per my reply. I added an example link.
– Rafael
Good night, Rafael! I will study with affection these tips that Oce passed me and see if I can advance in the project. Thank you again.
– Hugo