Example #1
0
 public static ISymbols <TSource> AsyncCall <TSource>(
     this ISymbols <TSource> source,
     Expression <Action <TSource> > call
     )
 {
     return(source.Provider.CreateSymbolsQuery <TSource>(
                Expression.Call(null,
                                ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource) }),
                                new Expression[] { source.Expression, call }
                                )
                ));
 }
Example #2
0
 public static ISymbol <TResult> Gather <TSource, TResult>(
     this ISymbols <TSource> source,
     Expression <Func <IEnumerable <TSource>, TResult> > reducer
     )
 {
     return(source.Provider.CreateSymbolQuery <TResult>(
                Expression.Call(null,
                                ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource), typeof(TResult) }),
                                new Expression[] { source.Expression, reducer }
                                )
                ));
 }
Example #3
0
 public static ISymbols <TValue> CachedCall <TSource, TKey, TValue>(
     this ISymbols <TSource> source,
     Expression <Func <TSource, TKey> > cacheKeySelector,
     Expression <Func <ISymbol <TSource>, ISymbol <TValue> > > call
     )
 {
     return(source
            .Call(s => new { s, r = Case_Cache <TKey, TValue> .CacheService.Get(cacheKeySelector.Compile()(s)) })
            .IfThenElse(
                r => r.r.HasValue,
                r => r.Call(v => v.r.Value),
                r => r.Call(v => v.s).Call(call)
                ));
 }
Example #4
0
 public static ISymbols <TResult> IfThenElse <TSource, TResult>(
     this ISymbols <TSource> source,
     Expression <Func <TSource, bool> > ifPredicate,
     Expression <Func <ISymbol <TSource>, ISymbol <TResult> > > thenBlock,
     Expression <Func <ISymbol <TSource>, ISymbol <TResult> > > elseBlock
     )
 {
     return(source.Provider.CreateSymbolsQuery <TResult>(
                Expression.Call(null,
                                ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource), typeof(TResult) }),
                                new Expression[] { source.Expression, ifPredicate, thenBlock, elseBlock }
                                )
                ));
 }
Example #5
0
 public static ISymbols <TSource> Top <TSource, TKey>(
     this ISymbols <TSource> source,
     Expression <Func <TSource, TKey> > keySelector,
     int count,
     bool isAscending
     )
 {
     return(source.Provider.CreateSymbolsQuery <TSource>(
                Expression.Call(null,
                                ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource) }),
                                new Expression[] { source.Expression, Expression.Constant(count) }
                                )
                ));
 }
Example #6
0
 public static ISymbols <TResult> WhileDo <TSource, TContext, TResult>(
     this ISymbols <TSource> source,
     Expression <Func <TSource, TContext> > contextInit,
     Expression <Func <TContext, bool> > exitPredicate,
     Expression <Action <ISymbol <TContext> > > loopBody,
     Expression <Func <TContext, TResult> > resultExtractor
     )
 {
     return(source.Provider.CreateSymbolsQuery <TResult>(
                Expression.Call(null,
                                ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource), typeof(TContext), typeof(TResult) }),
                                new Expression[] { source.Expression, contextInit, exitPredicate, loopBody, resultExtractor }
                                )
                ));
 }