0

I have a table named User in my database. I also have a .net core project where authentication is built-in. I want to connect to my database and after scaffolding reveals my User class, I want it to inherit from IdentityUser.

After scaffolding went well, I tried to inherit from IdentityUser.

public partial class User :IdentityUser<int>
{
    public int Id { get; set; }
    public string Country { get; set; }
    public string PersonalId { get; set; }
    public string MobilePhone { get; set; }
    public string Email { get; set; }
    public DateTime BirthDate { get; set; }
    public string Password { get; set; }
    public string Name { get; set; }
    public string Address { get; set; }
    public byte[] Idimage { get; set; }
    public bool? EmailConfirmed { get; set; }
    public bool? Smsconfirmed { get; set; }
}

I can not see Identity Fields like PasswordHash, PhoneNumberConfirmed and so on, in my database. Specifically, in User table.

Guga Todua
  • 462
  • 2
  • 11
  • 27
  • 1
    *After* scaffolding went well? I think you're doing things in the wrong order. Or you should add a migration. That said, IMO it's better to keep the identity model and the application model apart to have maximum freedom in how to use them both. F.e., if you'd switch to identity server in the future the User class would no longer need some of its properties. BTW currently you don't need (or *shouldn't* need!) the Password property. – Gert Arnold Sep 28 '19 at 19:04
  • @GertArnold After I did scaffolding, User class appeared in my project(Code). I'm trying migrations but Up() and Down() are empty. – Guga Todua Sep 28 '19 at 19:14
  • Could you share the definition of your DbContext ? Is the default DbContext generated by the scaffolding identity, or your own custom ? – Xueli Chen Sep 30 '19 at 09:54

0 Answers0