コード例 #1
0
        /// <summary>
        /// Queries the database for a set of records.
        /// </summary>
        /// <typeparam name="TEntity">Entity type</typeparam>
        /// <param name="connection"></param>
        /// <param name="statementOptions">Optional statement options (usage: statement => statement.SetTimeout().AttachToTransaction()...)</param>
        /// <returns>The record count</returns>
        public static Task <IEnumerable <TEntity> > FindAsync <TEntity>(
            this IDbConnection connection,
            Action <IRangedBatchSelectSqlSqlStatementOptionsOptionsBuilder <TEntity> > statementOptions = null)
        {
            var options = new RangedBatchSelectSqlSqlStatementOptionsOptionsBuilder <TEntity>();

            statementOptions?.Invoke(options);
            return(options.SqlStatementsFactoryChain().BatchSelectAsync(connection, options));
        }
コード例 #2
0
        /// <summary>
        /// Queries the database for a set of records.
        /// </summary>
        /// <typeparam name="TEntity">Entity type</typeparam>
        /// <param name="connection"></param>
        /// <param name="statementOptions">Optional statement options (usage: statement => statement.SetTimeout().AttachToTransaction()...)</param>
        /// <param name="transaction">Transaction for override the AttachToTransaction</param>
        /// <returns>The record count</returns>
        public static IEnumerable <TEntity> Find <TEntity>(
            this IDbConnection connection,
            Action <IRangedBatchSelectSqlSqlStatementOptionsOptionsBuilder <TEntity> > statementOptions,
            IDbTransaction transaction)
        {
            var options = new RangedBatchSelectSqlSqlStatementOptionsOptionsBuilder <TEntity>();

            statementOptions?.Invoke(options);
            options.AttachToTransaction(transaction);
            return(options.SqlStatementsFactoryChain().BatchSelect(connection, options));
        }