I have read something and know that it is possible to leave a connectionString dynamically in an ASP.NET MVC application. But is it possible to create n connections where each authenticated user on the system has its own connection to a particular database?
You know that banks are identical, just change the location of each.
If anyone knows how to solve this situation, suggestions are welcome, because at my level of knowledge, a web application has only one connection, where n users make queries, recordings, etc ... and if you change this connection changes to all users who are accessing it.
#EDIT - 08/08 15:18
I made some progress. As I use Entity, here's what I got:
public class Entidades : DbContext
{
public static string teste()
{
return HttpContext.Current.Session ["conString"] != null ? (string)HttpContext.Current.Session["conString"] : "Conexao";
}
public Entidades() : base(teste()) {}
public DbSet<Usuario> Usuario { get; set; }
public DbSet<Clientes> Clientes { get; set; }...
}
This Session is created right after the user login, where in the column of the main database user table the name of the connectionString is stored, I store the name in the session and use it.
But another question arises, how do I, according to the insertion or update of new users and their connectionString, is inserted automatically in the web.config the Connections? Is there such a possibility?