public void Execute() { if (ConnectionType == ConnectionManagerType.SQLite) { throw new ETLBoxNotSupportedException("This task is not supported with SQLite!"); } bool doesExist = new IfDatabaseExistsTask(DatabaseName) { DisableLogging = true, ConnectionManager = ConnectionManager }.DoesExist; if (!doesExist) { new SqlTask(this, Sql).ExecuteNonQuery(); } }
public void Execute() { if (ConnectionType == ConnectionManagerType.SQLite) { throw new ETLBoxNotSupportedException("This task is not supported with SQLite!"); } var connectionManager = ConnectionManager.CloneWithMasterDbConnectionString(); var ifDatabaseExists = new IfDatabaseExistsTask(DatabaseName) { DisableLogging = true, ConnectionManager = connectionManager }; bool doesExist = ifDatabaseExists.Exists(); if (doesExist) { return; } new SqlTask(this, Sql) { ConnectionManager = connectionManager }. ExecuteNonQuery(); }