如何建立内部现有的数据库ASP.Net身份表? [英] How to create ASP.Net Identity tables inside existing database?

查看:143
本文介绍了如何建立内部现有的数据库ASP.Net身份表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设我的第一个MVC 5 /实体框架的应用程序。我使用的数据库第一种方法在我的数据拉从现有的SQL Server。现有的SQL数据库从单独的Web窗体.NET应用程序接收它的数据。

展望未来,新的MVC应用程序与现有的Web窗体应用程序将共享数据库。

我使用的身份创建MVC应用程序中的用户帐户。所以在这一点上,我有我的MVC应用程序2的数据连接。一个用于用户帐户,另一个用于现有的SQL Server。

这是建立MVC项目的最佳方法是什么?展望未来,我将可以从Web窗体应用程序访问用户数据库?

我是新手,我想确保我正确地设置此功能。


解决方案

  

是否有用户表被添加到现有的SQL Server,或者是
  这个用户数据库完全独立的数据库?


您不需要两个数据库 - 您可以创建现有数据库中标识表。

ASP.Net身份使用实体框架code首先即可。因此,运行应用程序第一次使用前,要更新连接字符串和已有的数据库,通常是在 ApplicationDbContext

如果你已经有两个单独的数据库,并希望合并它们,你要的工具,如展鹏 - 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.

这篇关于如何建立内部现有的数据库ASP.Net身份表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆