Ejemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="connection"></param>
        /// <param name="param"></param>
        /// <param name="keySelector"></param>
        /// <param name="transaction"></param>
        /// <param name="commandTimeout"></param>
        /// <returns></returns>
        public static int Update <TEntity>(this IDbConnection connection, IEnumerable <TEntity> param, Expression <Func <TEntity, object> > keySelector = null,
                                           Expression <Func <TEntity, bool> > predicate = null,
                                           IDbTransaction transaction = null, int?commandTimeout = null)
            where TEntity : BaseEntity
        {
            ISqlAdapter adapter = GetSqlAdapter(connection);

            var sql = adapter.GetUpdate(predicate, keySelector);

            var result = connection.ExecuteExt <TEntity>(sql, param, transaction, commandTimeout);

            return(result);
        }