且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在现有数据库中创建ASP.Net身份表?

更新时间:2023-01-23 12:49:06


将用户表添加到现有的sql server中,还是
这个用户数据库是一个完全独立的数据库?


您不需要两个数据库 - 您可以在现有数据库内创建Identity表。



ASP.Net身份使用实体框架代码。因此,在首次运行应用程序之前,您希望将连接字符串更新为通常位于 ApplicationDbContext 中的现有数据库。





如果您已经有两个单独的数据库,并希望将它们合并,则需要像RedGate - SQL比较和数据比较这样的工具。



合并两个数据库完全是原来的问题;如果你有一个,请你单独提出一个问题。


I am building my first MVC 5 / Entity Framework application. I used the database first method to pull in my data from an existing SQL server. The existing SQL database receives it's data from a separate web forms .net application.

Moving forward, the new MVC application and the existing web forms application will share the database.

I am using Identity to create user accounts within the MVC application. So at this point, I have 2 data connections in my MVC application. One for the user accounts and the other for the existing SQL server.

Is this the best way to set up the MVC project? Moving forward, will I be able to access the user database from the web forms application?

I am a newbie, and I want to make sure I am setting this up correctly.

Will there the user tables be added to the existing sql server, or is this user database a completely separate database?

You do not need two databases - you can create Identity tables inside your existing database.

ASP.Net Identity uses Entity Framework Code First. Therefore, before running your application first time, you want to update Connection String same as existing database which is normally inside ApplicationDbContext.

If you already have two separate databases and want to merge them, you want to tool such as RedGate - SQL Compare and Data Compare.

Merging two database is totally out of original question; please kindly create a separate question if you have one.