I am building an app using ASP.Net MVC 5 framework with a database code approach. I need to add custom fields to my Users Table. What is the best way to add custom attributes and access them later? Here is what I have done so far
- Logged into SQL Server and added the column to the
AspNetUsers
table. I created a new class which
ApplicationUser
like myUser
class below.public class User : ApplicationUser { public int UserId { get; set; } public int CampId { get; set; } }
Additionally, I tried adding my custom attributes to the ApplicationUser
directly like the insstruction found on the answer in another question, but I get the following error
The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
What is the best way to add column to my AspNetUsers
table?
Also, How can I access these field from the controller using the Authorized user?