Beispiel #1
0
 /// <summary>Update by object's PropertyName.<para>When done dispose connection.</para></summary>
 /// <param name="connection">Database connection.</param>
 /// <param name="tableName">Target database's table.</param>
 /// <param name="updateItem">Table's column name extracted from PropertyName.</param>
 /// <param name="whereCondition">Where condition extracted from PropertyName.</param>
 /// <param name="parameterSymbol">Command parameter symbol. SqlServer = '@', MySql = '?', Oracle = ':'</param>
 /// <returns>Rows affected.</returns>
 public static int Update(IDbConnection connection, string tableName, object updateItem, object whereCondition, char parameterSymbol = '@')
 {
     using (var exec = new DbExecutor(connection, parameterSymbol))
     {
         return(exec.Update(tableName, updateItem, whereCondition));
     }
 }
Beispiel #2
0
        /// <summary>Update by object's PropertyName.<para>When done dispose connection.</para></summary>
        /// <param name="connection">Database connection.</param>
        /// <param name="tableName">Target database's table.</param>
        /// <param name="updateItem">Table's column name extracted from PropertyName.</param>
        /// <param name="whereCondition">Where condition extracted from PropertyName.</param>
        /// <param name="parameterSymbol">Command parameter symbol. SqlServer = '@', MySql = '?', Oracle = ':'</param>
        /// <returns>Rows affected.</returns>
        public static int Update(IDbConnection connection, string tableName, object updateItem, object whereCondition, char parameterSymbol = '@')
        {
            Contract.Requires <ArgumentNullException>(connection != null);
            Contract.Requires <ArgumentException>(!String.IsNullOrEmpty(tableName));
            Contract.Requires <ArgumentNullException>(whereCondition != null);
            Contract.Requires <ArgumentNullException>(updateItem != null);

            using (var exec = new DbExecutor(connection, parameterSymbol))
            {
                return(exec.Update(tableName, updateItem, whereCondition));
            }
        }