public async Task ShouldResolveSubQuery()
        {
            var innerRewriter = new Rewriter();
            var outerRewriter = new Rewriter();

            var inner = query.AsyncRewrite(innerRewriter);

            var outer = from dummy in query.AsyncRewrite(outerRewriter)
                        from other in inner
                        select new
            {
                dummy,
                other
            };

            var result = await outer.ToList();

            Assert.True(outerRewriter.VisitCalled);
            Assert.True(innerRewriter.VisitCalled);
        }
 /// <summary>
 /// Makes a query null-safe.
 /// </summary>
 /// <typeparam name="T">The type of the query data.</typeparam>
 /// <param name="value">A query.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable <T> ToAsyncNullsafe <T>(this IAsyncQueryable <T> value)
 {
     return(value.AsyncRewrite(new NullsafeQueryRewriter()));
 }
 /// <summary>
 /// Replaces method calls with lambda expressions.
 /// </summary>
 /// <typeparam name="T">The type of the query data.</typeparam>
 /// <param name="value">A query.</param>
 /// <param name="whitelist">A list of types to inject, whether marked as injectable or not.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable <T> ToAsyncInjectable <T>(this IAsyncQueryable <T> value, params Type[] whitelist)
 {
     return(value.AsyncRewrite(new InjectableQueryRewriter(whitelist)));
 }
示例#4
0
 /// <summary>
 /// Replaces methods of type <c>from</c> with methods of type <c>to</c>.
 /// </summary>
 /// <typeparam name="T">The type of the query data.</typeparam>
 /// <param name="value">A query.</param>
 /// <param name="from">A type to replace.</param>
 /// <param name="to">A type to use instead.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable <T> ToAsyncSubstitution <T>(this IAsyncQueryable <T> value, Type from, Type to)
 {
     return(value.AsyncRewrite(new SubstitutionQueryRewriter(from, to)));
 }
 /// <summary>
 /// Replaces methods of type <c>from</c> with methods of type <c>to</c>.
 /// </summary>
 /// <param name="value">A query.</param>
 /// <param name="from">A type to replace.</param>
 /// <param name="to">A type to use instead.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable ToAsyncSubstitution(this IAsyncQueryable value, Type from, Type to)
 => value.AsyncRewrite(new SubstitutionQueryRewriter(from, to));
 /// <summary>
 /// Makes a query null-safe.
 /// </summary>
 /// <param name="value">A query.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable ToAsyncNullsafe(this IAsyncQueryable value)
 => value.AsyncRewrite(new NullsafeQueryRewriter());
 /// <summary>
 /// Replaces method calls with lambda expressions.
 /// </summary>
 /// <typeparam name="T">The type of the query data.</typeparam>
 /// <param name="value">A query.</param>
 /// <param name="greenlist">A list of types to inject, whether marked as injectable or not.</param>
 /// <returns>A query proxy.</returns>
 public static IAsyncQueryable <T> ToAsyncInjectable <T>(this IAsyncQueryable <T> value, params Type[] greenlist)
 => value.AsyncRewrite(new InjectableQueryRewriter(greenlist));