/// <summary> /// Returns a lazyily loaded stream of results using a parameterized query. E.g: /// <para>db.SelectLazy(db.From<Person>().Where(x => x == 40))</para> /// </summary> public static IEnumerable <T> SelectLazy <T>(this IDbConnection dbConn, SqlExpression <T> expression) { return(dbConn.ExecLazy(dbCmd => dbCmd.SelectLazy <T>(expression.ToSelectStatement(), expression.Params))); }
/// <summary> /// Selects the multi asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="T2">The type of the t2.</typeparam> /// <typeparam name="T3">The type of the t3.</typeparam> /// <param name="dbCmd">The database command.</param> /// <param name="q">The q.</param> /// <param name="token">The cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>Task<List<Tuple<T, T2, T3>>>.</returns> internal static Task <List <Tuple <T, T2, T3> > > SelectMultiAsync <T, T2, T3>(this IDbCommand dbCmd, SqlExpression <T> q, CancellationToken token) { q.Select(q.CreateMultiSelect <T, T2, T3, EOT, EOT, EOT, EOT, EOT>(dbCmd.GetDialectProvider())); return(dbCmd.ExprConvertToListAsync <Tuple <T, T2, T3> >(q.ToSelectStatement(QueryType.Select), q.Params, q.OnlyFields, token)); }
internal static long RowCount <T>(this IDbCommand dbCmd, SqlExpression <T> expression) { return(dbCmd.Scalar <long>(dbCmd.GetDialectProvider().ToRowCountStatement(expression.ToSelectStatement()))); }