Search code examples
asp.netentity-frameworkasp.net-mvc-5asp.net-membershipasp.net-identity-2

Customizing AspNet Identity Authentication DB objects


I am using Microsoft.AspNet.Identity.EntityFramework.IdentityDbContext class for authentication of my users. This is a new concept to me and it confuses me a lot.

By default it creates 5 tables with default names: AspNetRoles, AspNetUserRoles, AspNetUserLogins, AspNetUsers which I think are a bit forcing on the user and does not suit my architecture. Also I want to add more columns to the above mentioned tables.

Is there a way to change the table names and add new columns to the existing tables?

using VS 2013, SQL Server 2014 Express.


Solution

  • By default the class for the user that you get from the project template is called something like ApplicationUser. Just adding new properties to that one let you store new columns.

    Here is a question that explains how to change the table names: How can I change the table names when using Visual Studio 2013 ASP.NET Identity?