1) What if I want to call it User instead of ApplicationUser?
You can change any names you want, just make sure you replace ApplicationUser with a name.
2) Maybe I want to add navigation properties so that I can establish relationships with my other models?
If you have a class call address, you want to add addressId as a foreign key, see below:
public class Address { public int Id { get; set; } public string Street { get; set; } } public class User : IdentityUser { public string HomeTown { get; set; } public DateTime? BirthDate { get; set; } public int AddressId { get; set; } [ForeignKey("AddressId")] public virtual Address Address { get; set; } } public class ApplicationDbContext : IdentityDbContext<User> { public ApplicationDbContext() : base("DefaultConnection") { } public DbSet<Address> Addresses { get; set; } }
3) Also, when I look at the table, the name is AspNetUsers instead of ApplicationUser.
ASP.NET authentication is inherited from 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 change this table name by changing IdentityModel.cs. See the following link for more details:
How to change table names when using ASP.NET ID for Visual Studio 2013?
4) What if I want to use my own context?
You can create your own DBContex, MVC 5 will allow you to have multiple DBC text, such as ApplicationDbContext and DataDbContext (custom DbContext). ApplicationDbContext usually contains an ASP.NET membership data table. DataDbContext usually contains non-user data tables.
public class Blog { public int BlogId { get; set; } public int Title { get; set; } } public class MyDbContext : DbContext { public MyDbContext() : base("DefaultConnection") { } public DbSet<Blog> Blogs { get; set; } }
Note. You may need to use EF Migrations, see the details here:
Customizing an ASP.Net Identity User Profile