Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

How to add ASP.NET MVC5 Identity Authentication to existing database

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...