public RelationalDatabaseWriterSimulator(SqlEtlConfiguration configuration) : base(configuration.FactoryName) { _configuration = configuration; _providerFactory = DbProviderFactories.GetFactory(configuration.FactoryName); _commandBuilder = _providerFactory.InitializeCommandBuilder(); }
public RelationalDatabaseWriter(SqlEtl etl, DocumentDatabase database) : base(etl.Configuration.FactoryName) { _etl = etl; _database = database; _logger = LoggingSource.Instance.GetLogger <RelationalDatabaseWriter>(_database.Name); _providerFactory = GetDbProviderFactory(etl.Configuration); _commandBuilder = _providerFactory.InitializeCommandBuilder(); _connection = _providerFactory.CreateConnection(); _connection.ConnectionString = etl.Configuration.Connection.ConnectionString; try { _connection.Open(); } catch (Exception e) { database.NotificationCenter.Add(AlertRaised.Create( database.Name, SqlEtl.SqlEtlTag, $"SQL ETL could not open connection to {_connection.ConnectionString}", AlertType.SqlEtl_ConnectionError, NotificationSeverity.Error, key: _connection.ConnectionString, details: new ExceptionDetails(e))); throw; } _tx = _connection.BeginTransaction(); _stringParserList = GenerateStringParsers(); }
public RelationalDatabaseWriter(SqlEtl etl, DocumentDatabase database) : base(etl.Configuration.Connection.FactoryName) { _etl = etl; _database = database; _logger = LoggingSource.Instance.GetLogger <RelationalDatabaseWriter>(_database.Name); _providerFactory = GetDbProviderFactory(etl.Configuration); _commandBuilder = _providerFactory.InitializeCommandBuilder(); _connection = _providerFactory.CreateConnection(); var connectionString = etl.Configuration.Connection.ConnectionString; _connection.ConnectionString = connectionString; OpenConnection(database, etl.Configuration.Name, etl.Configuration.ConnectionStringName); _tx = _connection.BeginTransaction(); _stringParserList = GenerateStringParsers(); }