public DataContextBase(DataContextParams contextParams) { _dataContextParams = contextParams; _connectionString = contextParams.ConnectionString; _connectionStringConfigKey = contextParams.ConnectionStringConfigKey; if (string.IsNullOrEmpty(_connectionString)) { IConfigurationRoot configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", optional: false).Build(); _connectionString = configuration.GetConnectionString(_connectionStringConfigKey); } var t = this.GetType(); _settings = new DataContextSettings(); Configure(_settings); _tables = _settings.GetTables().ToList(); _schema = _settings.GetSchemaName(); _db = Activator.CreateInstance(_settings.GetDriverType()) as IStoreDatabaseDriver; _db.Configure(new StoreDatabaseDriverSettings { ConnectionString = _connectionString }); if (_dataContextParams.ApplyMigrations) { ApplyMigrations(); } }
public void Configure(StoreDatabaseDriverSettings settings) { _storeDatabaseDriver.Configure(settings); }