/// <summary> /// Creates and opens a new database connection. /// </summary> public SqlScriptConnection Open() { var dbConnection = OnCreateConnection(); var connection = new SqlScriptConnection(scriptCollection, dbConnection); try { connection.Open(); return(connection); } catch { connection.Dispose(); throw; } }
/// <summary> /// Creates and opens a new database connection asynchronously. /// </summary> public async Task <SqlScriptConnection> OpenAsync() { var dbConnection = OnCreateConnection(); var connection = new SqlScriptConnection(scriptCollection, dbConnection); try { await connection.OpenAsync(); return(connection); } catch { connection.Dispose(); throw; } }