Change column names of tables created by Asp.Net Identity

3

My question is simple, but I can not solve it. Is it possible to change the name of the columns in the AspNetUsers table that Identity creates in the database?

Another question is, how to add new fields in this table, and one of them will be related to another table?

I'm working with Entity Framework Code First.

Thanks for the help.

    
asked by anonymous 21.09.2016 / 06:01

1 answer

4
  

Is it possible to change the name of the columns of the AspNetUsers table that Identity creates in the database?

No. The name of the columns is essential for a security check done by IdentityDbContext at context initialization ( see here of lines 127 to 132 ).

You can rename tables if you want. I explain this here .

  

Another question is, how do I add new fields in this table, one of which will be related to another table?

Deriving entity:

public class Usuario : IdentityUser 
{
    public String InformacaoNova1 { get; set; }
    public String InformacaoNova2 { get; set; }
    public String InformacaoNova3 { get; set; }
}

And typing the context with your class Usuario :

public class MeuContexto : IdentityDbContext<Usuario> { ... }

I show you how to change some aspects of ASP.NET Identity here .

    
21.09.2016 / 06:12