If you are using ASP.NET Identity, the correct one is your Usuario
inherit from IdentityUser
:
public class Usuario : IdentityUser { ... }
Table naming settings can be changed through the event OnModelCreating
using Fluent API:
public class ApplicationDbContext : IdentityDbContext<Usuario>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>()
.ToTable("Usuarios", "dbo").Property(p => p.Id).HasColumnName("UsuarioId");
modelBuilder.Entity<Usuario>()
.ToTable("Usuarios", "dbo").Property(p => p.Id).HasColumnName("UsuarioId");
}
}
Similarly, this can be done to IdentityUserClaim
:
public class UsuarioIdentificacao : IdentityUserClaim { ... }
And the configuration:
modelBuilder.Entity<IdentityUserClaim>()
.ToTable("UsuarioIdentificacoes", "dbo").Property(p => p.Id).HasColumnName("UsuarioIdentificacaoId");
modelBuilder.Entity<UsuarioIdentificacao>()
.ToTable("UsuarioIdentificacoes", "dbo").Property(p => p.Id).HasColumnName("UsuarioIdentificacaoId");
Samuel, I’m not finding your question very clear, what you want is for your new table to have a relationship with Aspnetuserclaims?
– Pablo Tondolo de Vargas
No friend, I want the relationship that already exists between Claims and users to be erased and create a new one between Claims and another that I will create.
– Samuel Phellip
But because you want to do this, you would have as per the code of your class?
– Pablo Tondolo de Vargas
The Userclaims table creates an access for each user, wanted to create an access and several users use msm. Still not have much code beast, not yet created the screens precisely because of this relationship.
– Samuel Phellip
I believe that the path you are trying to follow is not correct. When you have the classes of your template, edit the question and put them.
– Pablo Tondolo de Vargas
How can I do it then? I already have the classes of user registration, company registration. I would create the agra access registration screens, but then arose this relationship problem.
– Samuel Phellip
Let’s go continue this discussion in chat.
– Pablo Tondolo de Vargas