Example #1
0
        /// <summary>
        /// Selects the rows that match the given condition.
        /// </summary>
        /// <typeparam name="T">The table type.</typeparam>
        /// <param name="connection">The connection to query on.</param>
        /// <param name="whereExpr">The where condition to use for this query.</param>
        /// <param name="transaction">The transaction to use for this query.</param>
        /// <param name="buffered">Whether to buffer the results in memory.</param>
        /// <param name="commandTimeout">Number of seconds before command execution timeout.</param>
        /// <returns>The rows that match the given condition.</returns>
        public static IEnumerable <T> GetList <T>(this IDbConnection connection, Expression <Func <T, bool> > whereExpr, IDbTransaction transaction = null, bool buffered = true, int commandTimeout = 30)
            where T : class
        {
            ISqlQueries <T>        queries = ExtraCrud.Queries <T>();
            WhereConditionData <T> data    = queries.Compile(whereExpr);
            IEnumerable <T>        list    = queries.GetList(connection, data.WhereCondition, data.Param, transaction, buffered, commandTimeout);

            return(list);
        }