I'm using ASP.NET Identity on my web form application. Below is my current identity tables:
Current Identity tables
- Role
- User
- UserClaim
- UserLogin
- UserRole
I need to add a new table to store additional information.
New Table: UserLogs
Fields inside the new table:
- UserLogID (PK)
- UserID (FK)
- IPAddress
- LoginDate
How can I add this custom table? I know how to add custom fields inside existing table but I don't know how to achieve this.
I appreciate your efforts in reaching a solution for my problem.
first of all I'd suggest you to understand a bit about Code-First Entity Framework, because that's how those tables about users is created when you first create New MVC5 Applictation.
Here you can find how it is implemented if you want to use code-first database creating through the EntityFramework.
After you understand some core stuff about it, you can go to your project on Models folder, straight to> AccountModel.cs
There you have a Class which extends DbContext, which inside contains the constructor which gives access to the connectionstring on which database is about to be used.
Short important stuff if u are lazy on reading code first too much:
DbSet means that the model inside dbset, is about to be created into a table. Variables inside class, are columns that are about to be created. But if you want foreign keys and stuff, you definitely have to read code-first kind of.
Good Luck!