Vladimir Potapov
Vladimir Potapov

Reputation: 2437

Building a website with multiple database instances for each user type(.net)

I am building a website for big companies,the website will look the same,but the company "A" have sensitive data and they want to keep database at they place(server),the company "B" don't have any sensitive data sow they don't have a problem to keep database at my website server.How can i (if it possible) to use database company "A" if user if type "A" is logged in,and if it is user type"B" use another database.I need to change the connection string for each type of user,because each one of users-type(company) want to have they own database in place they think it safe.

I am currently checking the MVC/6 and Asp.Net5 for this decision.

Which approach is best?

Thanks in advance!

Upvotes: 1

Views: 252

Answers (1)

Taleeb
Taleeb

Reputation: 1919

There can be several ways to achieve this. One way is to use a "security" database which would contain two data tables. One table would contain connection string of main database. The second table would contain user credentials along with data source the user have access to..

enter image description here

When a user logs in, the program can get the corresponding connection string and based on it login to the correct data source.

One user can also have, if you want, access to multiple data source. Once the user logs in he can be redirected to a screen to select the database he wants to login into.

Upvotes: 1

Related Questions