|
| 1 | +// <auto-generated/> |
| 2 | +#nullable disable |
| 3 | + |
| 4 | +#nullable enable |
| 5 | +using ExpressiveSharp.Mapping; |
| 6 | +using Foo; |
| 7 | + |
| 8 | +namespace ExpressiveSharp.Generated |
| 9 | +{ |
| 10 | + static partial class Foo_Row |
| 11 | + { |
| 12 | + // [ExpressiveProperty("Previous")] |
| 13 | + // private Row? PreviousExpr => QueryContext.Query<Row>().Where(f => f.GroupId == GroupId && f.CreatedAt < CreatedAt).OrderByDescending(f => f.CreatedAt).FirstOrDefault(); |
| 14 | + static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Row, global::Foo.Row>> Previous_Expression() |
| 15 | + { |
| 16 | + var p__this = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Row), "@this"); |
| 17 | + var expr_4 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::Foo.QueryContext).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Query" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 0)).MakeGenericMethod(typeof(global::Foo.Row)), global::System.Array.Empty<global::System.Linq.Expressions.Expression>()); // QueryContext.Query<Row>() |
| 18 | + var p_f_6 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Row), "f"); // f => f.GroupId == GroupId && f.CreatedAt < CreatedAt |
| 19 | + var expr_9 = global::System.Linq.Expressions.Expression.Property(p_f_6, typeof(global::Foo.Row).GetProperty("GroupId")); // f.GroupId |
| 20 | + var expr_10 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Row).GetProperty("GroupId")); // GroupId |
| 21 | + var expr_8 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.Equal, expr_9, expr_10); |
| 22 | + var expr_12 = global::System.Linq.Expressions.Expression.Property(p_f_6, typeof(global::Foo.Row).GetProperty("CreatedAt")); // f.CreatedAt |
| 23 | + var expr_13 = global::System.Linq.Expressions.Expression.Property(p__this, typeof(global::Foo.Row).GetProperty("CreatedAt")); // CreatedAt |
| 24 | + var expr_11 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.LessThan, expr_12, expr_13, false, typeof(global::System.DateTime).GetMethod("op_LessThan", global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static, null, new global::System.Type[] { typeof(global::System.DateTime), typeof(global::System.DateTime) }, null)); |
| 25 | + var expr_7 = global::System.Linq.Expressions.Expression.MakeBinary(global::System.Linq.Expressions.ExpressionType.AndAlso, expr_8, expr_11); |
| 26 | + var expr_14 = global::System.Linq.Expressions.Expression.Lambda<global::System.Func<global::Foo.Row, bool>>(expr_7, p_f_6); |
| 27 | + var expr_5 = global::System.Linq.Expressions.Expression.Quote(expr_14); |
| 28 | + var expr_3 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Queryable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "Where" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 2 && m.GetParameters()[0].ParameterType.IsGenericType && !m.GetParameters()[0].ParameterType.IsGenericParameter && m.GetParameters()[1].ParameterType.IsGenericType && !m.GetParameters()[1].ParameterType.IsGenericParameter && m.GetParameters()[1].ParameterType.GetGenericArguments()[0].IsGenericType && m.GetParameters()[1].ParameterType.GetGenericArguments()[0].GetGenericTypeDefinition() == typeof(global::System.Func<,>))).MakeGenericMethod(typeof(global::Foo.Row)), new global::System.Linq.Expressions.Expression[] { expr_4, expr_5 }); |
| 29 | + var p_f_16 = global::System.Linq.Expressions.Expression.Parameter(typeof(global::Foo.Row), "f"); // f => f.CreatedAt |
| 30 | + var expr_17 = global::System.Linq.Expressions.Expression.Property(p_f_16, typeof(global::Foo.Row).GetProperty("CreatedAt")); // f.CreatedAt |
| 31 | + var expr_18 = global::System.Linq.Expressions.Expression.Lambda<global::System.Func<global::Foo.Row, global::System.DateTime>>(expr_17, p_f_16); |
| 32 | + var expr_15 = global::System.Linq.Expressions.Expression.Quote(expr_18); |
| 33 | + var expr_2 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Queryable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "OrderByDescending" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 2 && m.GetParameters().Length == 2 && m.GetParameters()[0].ParameterType.IsGenericType && !m.GetParameters()[0].ParameterType.IsGenericParameter && m.GetParameters()[1].ParameterType.IsGenericType && !m.GetParameters()[1].ParameterType.IsGenericParameter && m.GetParameters()[1].ParameterType.GetGenericArguments()[0].IsGenericType && m.GetParameters()[1].ParameterType.GetGenericArguments()[0].GetGenericTypeDefinition() == typeof(global::System.Func<,>))).MakeGenericMethod(typeof(global::Foo.Row), typeof(global::System.DateTime)), new global::System.Linq.Expressions.Expression[] { expr_3, expr_15 }); |
| 34 | + var expr_1 = global::System.Linq.Expressions.Expression.Convert(expr_2, typeof(global::System.Linq.IQueryable<global::Foo.Row>)); |
| 35 | + var expr_0 = global::System.Linq.Expressions.Expression.Call(global::System.Linq.Enumerable.First(global::System.Linq.Enumerable.Where(typeof(global::System.Linq.Queryable).GetMethods(global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Static), m => m.Name == "FirstOrDefault" && m.IsGenericMethodDefinition && m.GetGenericArguments().Length == 1 && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType.IsGenericType && !m.GetParameters()[0].ParameterType.IsGenericParameter)).MakeGenericMethod(typeof(global::Foo.Row)), new global::System.Linq.Expressions.Expression[] { expr_1 }); |
| 36 | + return global::System.Linq.Expressions.Expression.Lambda<global::System.Func<global::Foo.Row, global::Foo.Row>>(expr_0, p__this); |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | + |
| 42 | +// === |
| 43 | + |
| 44 | +// <auto-generated/> |
| 45 | +#nullable enable |
| 46 | + |
| 47 | +namespace Foo |
| 48 | +{ |
| 49 | + partial class Row |
| 50 | + { |
| 51 | + private global::Foo.Row? _previous; |
| 52 | + private bool _previousHasValue; |
| 53 | + public global::Foo.Row? Previous |
| 54 | + { |
| 55 | + get => _previousHasValue ? _previous : PreviousExpr; |
| 56 | + init |
| 57 | + { |
| 58 | + _previousHasValue = true; |
| 59 | + _previous = value; |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | +} |
0 commit comments