Change ASP.NET Identity to use existing database

前端 未结 2 1740
攒了一身酷
攒了一身酷 2021-01-06 02:29

I\'m using ASP.NET MVC 5 with a Database-First workflow. I\'ve created the Identity tables (AspNetUsers, AspNetRoles etc.) in my existing database

相关标签:
2条回答
  • 2021-01-06 02:57

    You can resolved this problem by following these steps:

    • 1-create aspnetuser etc tables on your database (whatever DB you want to use)
    • simply connect the application with that database not using entity framework, i'm saying just simple connection.
    • you will find connection string in web.config file.

    • place this connection string into identity model clsss

    • your Register and Token methods now running
    • now you can use entity framewoek for rest of your tables by data first approach
    0 讨论(0)
  • 2021-01-06 03:10

    I THINK this scenario is not supported by ASP.NET Identity as it needs a DbContext which extends IdentityDbContext<ApplicationUser> (or similar).

    Why are you forcing Identity into your DB-First context?
    You can use a Code-First context for Identity alongside your other DB-First context without problems...

    0 讨论(0)
提交回复
热议问题