コード例 #1
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));
 }
コード例 #2
0
 /// <summary>Functionally similar to Enumerable.OrderByDescending.</summary>
 /// <param name="keySelector">Must be a simple property/field expression on the record class returning the column value. The table must have the index to sort on this column.</param>
 public static IEnumerable <tRow> orderByDescending <tRow, tKey>(this Recordset <tRow> rs, Expression <Func <tRow, tKey> > keySelector) where tRow : new()
 {
     return(rs.orderBy(keySelector, true));
 }
コード例 #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));
        }