Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create ASP.Net Identity tables inside existing database?

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.

like image 389
Daniela Avatar asked Feb 20 '15 19:02

Daniela


People also ask

How can I connect existing database in asp net?

If you want to connect to the SQL database into ASP.NET, using C#, it should follow the steps given below. Now, Open Visual Studio 2015 Update 3, go to the File >> New >> Project or use the shortcut key "Ctrl+Shift +N". Here, select Visual C# >> Web >> ASP.NET Web Application. Finally, click "OK" button.

How do I add OWIN to an existing project?

Add OWIN startup and authentication configuration classesIn Solution Explorer, right-click your project, select Add, and then Add New Item. In the search text box dialog, type "owin". Name the class "Startup" and select Add.


1 Answers

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.

enter image description here

If you already have two separate databases and want to merge them, you want to use tools 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.

like image 87
Win Avatar answered Sep 30 '22 11:09

Win