Different databases for the same Asp.net C#

Asked

Viewed 586 times

1

In a club management system each club has its own database.

There is a class DAL where it is responsible for obtaining the web.config to string of application connection.

How to ensure that at login the application loaded the correct database according to the club?

  • You could describe in detail what your application’s data access layer looks like in the body of your question?

  • I have a DAL class where it is in charge of getting from web.config the connection string of the application.

  • So, but that’s not enough. We need more information. Are Databases in the same technology (Mysql)? Is the database agnostic or do you only use Mysql objects? How does the system load the data? You can put an example of a simple selection and a simple update?

  • All databases are MYSQL, in the system only mysql objects are used.

2 answers

4

A simple way to do this would be to create a table specifying the database of each club (I’m not talking about putting data access to the bank), so when the user of some club logs in, you can check which bank the club belongs to.

Ex.:

inserir a descrição da imagem aqui

Abs,

  • All right. This is a good option for the scenario in question. I will give a studied in this form of access to the system.

1

You could have a main database, where will be common tables, as user for example.

It will have the information of which is the database used by that user.

Consequently, you would need to have two DAL structures to support this action.

But....

As I understand it, all the clubs have their own database, but all the databases are in one place, right? If so, I would consider unifying the databases, leaving a single database and putting the information in the records stating which club that record is.

This would make it easier, for example, to have consolidated information from several clubs of the same owner, for example.

  • All clubs have their own database, but in the case of this application the bases are in different places, because the system is published in each club individually.

  • In this case, Voce has an application in each club, right? It would be to have an Ini file with this access information. In C# at least you have Web.config, where Voce can put the database access information. What I suggested above would be in case I have access to all clubs for example. But it does not apply in this situation you have now put

Browser other questions tagged

You are not signed in. Login or sign up in order to post.