Link ASP.NET Identity users to user detail table

后端 未结 5 2077
旧巷少年郎
旧巷少年郎 2020-12-29 16:46

I\'ve used default MVC template with individual authorization. After running the application it automatically creates the required Identity tables. I\'ve successfully regist

5条回答
  •  粉色の甜心
    2020-12-29 17:08

    The way identity interfaces with the database is automatic via the entity framework. In your solution there should be a class called ApplicationDbContext, this is the entity framework context. Personally i would suggest looking up some entity framework guides and work out how it interacts with identity. but a quick overview would be :

    To add another table to your database with entity framework you would need to add a DbSet into the context.

    public DbSet personalInformation {get;set;}
    

    Then you would need to update the ApplicationUser to hold a reference to a personalInforamtion. Then you would need to migrate the database to the latest version, either with a generated migration or with automatic migrations.

    Any changes you would then do would be through the entity framework.

提交回复
热议问题