We have an application that uses multiple databases for different users. We are using a generic repository and unit-of-work pattern and dependency injection. We have a DbContext
which is a parameterized one. What we want is when users comes to our website, we want the DbContext
point to their website for that particular transaction.
We tried registering the DbContext
on the unity configuration and override it in the controller level. But that failed. Can anyone let us know how to get it done?
DBContext
public class TimperContext: IdentityDbContext<MyUser>
{
public TimperContext(string connectionString) : base(connectionString) { }
public DbSet<UserAddress> UserAddresses { get; set; }
}