Exemple #1
0
        /// <summary>
        /// Executes all of the statements that have been added. This is non-transactional. Execution will continue even if
        /// some statements fail. If you need atomicity you should ensure there is an ambient transaction.
        /// </summary>
        /// <returns>The total number of rows modified by all statements.</returns>
        public int Execute()
        {
            if (commands.Count == 0)
            {
                return(0);
            }

            using (var conn = db.GetOpenConnection())
                using (var set = new PublicSqlCommandSet(conn))
                {
                    commands.ForEach(set.Append);

                    return(set.ExecuteNonQuery());
                }
        }
Exemple #2
0
 /// <summary>
 /// Returns a raw and open SqlConnection for manual use.
 /// </summary>
 public static SqlConnection GetOpenConnection()
 {
     return(db.GetOpenConnection());
 }