public void Test_FdbQueryTransformExpression() { var expr = FdbQueryExpressions.Transform( FdbQueryExpressions.RangeStartsWith(TuPack.EncodeKey("Hello", "World")), (kvp) => kvp.Value.ToUnicode() ); Log(expr); Assert.That(expr, Is.Not.Null); Assert.That(expr.Source, Is.Not.Null.And.InstanceOf <FdbQueryRangeExpression>()); Assert.That(expr.Transform, Is.Not.Null); Assert.That(expr.Type, Is.EqualTo(typeof(IAsyncEnumerable <string>))); Assert.That(expr.ElementType, Is.EqualTo(typeof(string))); Log(FdbQueryExpressions.ExplainSequence(expr)); }
/// <summary>Projects each element of a sequence query into a new form.</summary> public static IFdbAsyncSequenceQueryable <R> Select <T, R>(this IFdbAsyncSequenceQueryable <T> query, Expression <Func <T, R> > selector) { if (query == null) { throw new ArgumentNullException(nameof(query)); } if (selector == null) { throw new ArgumentNullException(nameof(selector)); } var sourceExpr = query.Expression as FdbQuerySequenceExpression <T>; if (sourceExpr == null) { throw new ArgumentException("query"); } var expr = FdbQueryExpressions.Transform(sourceExpr, selector); return(query.Provider.CreateSequenceQuery <R>(expr)); }