コード例 #1
0
 /// <summary>Run a pre-compiled query, return all matching records.</summary>
 public static IEnumerable <tRow> all <tRow>(this Recordset <tRow> rs, Query <tRow> q, params object[] args) where tRow : new()
 {
     q.query(rs, args);
     if (q.multivalues)
     {
         return(rs.uniq());
     }
     return(rs.all());
 }
コード例 #2
0
 /// <summary>Functionally similar to Enumerable.Where</summary>
 /// <remarks>
 /// <para>The table must have the index to perform the query. This method doesn't fall back to the MS-provided LINQ when there's no index, it will throw an exception instead.
 /// This is by design: ESENT indices can be faster than linear table scan by orders of magnitudes. If you need to filter usnig linear scan, call Recordset.all() and then filter however you like using the full power of LINQ.</para>
 /// <para>Only a small subset of expressions is supported by the query compiler.</para>
 /// <para>It's recommended to precompile your queries on startup to save some CPU time.</para>
 /// <seealso cref="filter{tRow}" />
 /// </remarks>
 public static IEnumerable <tRow> where < tRow > (this Recordset <tRow> rs, Expression <Func <tRow, bool> > exp) where tRow : new()
 {
     Query <tRow> q = filter(rs.cursor.serializer, exp);
     return(rs.all(q));
 }
コード例 #3
0
        static IEnumerable <tRow> orderBy <tRow, tKey>(this Recordset <tRow> rs, Expression <Func <tRow, tKey> > keySelector, bool flip) where tRow : new()
        {
            Query <tRow> q = sort(rs.cursor.serializer, keySelector, flip);

            return(rs.all(q));
        }