Exemple #1
0
        public Task <TContext> CreateDbContext()
        {
            var connectionString = _connectionStringProvider.GetForCustomer();

            var optionsBuilder = new DbContextOptionsBuilder <TContext>();

            optionsBuilder.UseSqlServer(connectionString);

            var ctx = (TContext)Activator.CreateInstance(typeof(TContext), optionsBuilder.Options);

            return(Task.FromResult(ctx));
        }
Exemple #2
0
        public IDbConnection GetTenant()
        {
            var connectionString = _connectionStringProvider.GetForCustomer();

            return(new SqlConnection(connectionString));
        }