示例#1
0
        /// <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;
            }
        }
示例#2
0
        /// <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;
            }
        }