I'm trying to go through this tutorial on the External Authentication Services (C#). I need some initial explanations to go forward. Looking inside the default template that ships MVC5, I see this:
// You can add profile data for the user ...
public class ApplicationUser : IdentityUser
{
public string HomeTown { get; set; }
public DateTime? BirthDate { get; set; }
}
What if I want to call it User instead of ApplicationUser? Maybe I want to add a navigation properties so I can establish relationship with my other models? Also when I look at the table, the name is AspNetUsers instead of ApplicationUser. Finally, What if I want to use my own context?
Thanks for helping.
You can change to any names you want, just make sure to replace ApplicationUser with the name.
If you have a class call Address, you want to add addressId as a foreign key, see below:
ASP.NET Identity is inherited from the The ASP.NET membership system. When you register a new user using the default template, AspNetUsers and AspNetUserRoles etc.. these tables are created by default. You can modify these table name by modifying the IdentityModel.cs. For more detail take a look at the following link:
How can I change the table names when using Visual Studio 2013 ASP.NET Identity?
You can create your own DBContex, MVC 5 allow you to have mutiple DBContext, such as ApplicationDbContext and DataDbContext(custom DbContext). ApplicationDbContext usually contains ASP.NET Membership data table. DataDbContext usually contains data tables unrelated to users.
Note: You may need to use EF Migrations, see details here :
ASP.Net Identity customizing UserProfile