Data.Context.IdentityUserLogin:: EntityType 'IdentityUserLogin' has no key defined. Set the key for this EntityType. Data.Context.IdentityUserRole:: EntityType 'IdentityUserRole' has no key defined. Set the key for this EntityType. IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined. IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.
Service Entity (Simplified):
public class Servico
{
public int Id { get; set; }
public string Nome { get; set; }
public virtual ApplicationUser Usuario { get; set; }
}
Identity OnModelCreating:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>()
.ToTable("Usuarios")
.Property(p => p.Id)
.HasColumnName("UsuarioId");
modelBuilder.Entity<ApplicationUser>()
.ToTable("Usuarios")
.Property(p => p.Id)
.HasColumnName("UsuarioId");
modelBuilder.Entity<IdentityUserRole>()
.ToTable("UsuarioPapel");
modelBuilder.Entity<IdentityUserLogin>()
.ToTable("Logins");
modelBuilder.Entity<IdentityUserClaim>()
.ToTable("Claims");
modelBuilder.Entity<IdentityRole>()
.ToTable("Papeis");
}