如何添加ASP.NET MVC5身份认证现有的数据库 [英] How to add ASP.NET MVC5 Identity Authentication to existing database

查看:360
本文介绍了如何添加ASP.NET MVC5身份认证现有的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习MVC5身份认证和www.asp.net被阅读材料。
我有几个问题在这里。


  1. 如果我想使用身份认证,有没有理由不使用MVC模板?或者是有什么理由用空的模板? MVC模板还提供引导。


  2. 我有一个数据库中创建的,我想有一个DB率先发展。如果我使用MVC模板,凭据数据库将在项目文件夹下创建。我如何合并两个数据库,或者我应该只使用两个数据库?


如果我的问题是愚蠢的,只是不理我或者给先告诉我读什么。
我知道人们在社会上是好的,但关键。
谢谢


解决方案

  

1)如果我想使用身份认证,有没有理由不使用
  MVC模板?或者是有什么理由用空的模板? MVC模板
  还提供引导。


身份认证,MVC的模板和引导是不是真的有关。

如果您创建新的MVC应用5,的AccountController 为您创建。您可以使用的AccountController 为出发点。

如果你愿意,你可以删除的AccountController 并创建一个自己,但它是一个大量的工作。


  

2)我有一个数据库中创建的,我想有一个DB率先发展。如果我
  使用MVC模板,凭据数据库将被创建
  根据项目文件夹中。我如何合并两个数据库,或者我应该
  只使用两个数据库?


您不需要两个数据库 - 你可以把身份表,并在同一个数据库自定义表。

开始与身份 - 让它创建数据库及其所需的表。然后,您可以添加自定义表的身份数据库。

或者

如果您已经有一个连接字符串的数据库,你可以在以下地点更改标识连接名称。标识将创建一个现有的数据库中的表。

I am learning MVC5 identity authentication and was reading materials on www.asp.net. I have a few questions here.

  1. If I want to use identity authentication, is there a reason not to use MVC template? Or is there a reason to use empty template? MVC template also provides bootstrap.

  2. I have a database created, I want to have a DB first development. If I use the MVC template, the database for credentials will be created under the project folder. How can I merge the two database or I should just use two databases?

If my question is silly, just ignore me or give tell me what to read first. I know people in the community are good but critical. Thank you

解决方案

1) If I want to use identity authentication, is there a reason not to use MVC template? Or is there a reason to use empty template? MVC template also provides bootstrap.

Identity authentication, MVC template and bootstrap are not really related.

If you create new MVC 5 application, AccountController is created for you. You can use that AccountController as starting point.

If you want, you can delete the AccountController and create one yourself, but it is a lot of work.

2) I have a database created, I want to have a DB first development. If I use the MVC template, the database for credentials will be created under the project folder. How can I merge the two database or I should just use two databases?

You do not need two databases - you can place Identity tables and your custom tables in same database.

Start with Identity - let it creates database and its required tables. Then you can add custom tables to that Identity database.

Or

If you already have database with connection string, you can change the Identity connection name at the following place. Identity will create its tables inside that existing database.

这篇关于如何添加ASP.NET MVC5身份认证现有的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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