Пример #1
0
        public void SortByNestedProp()
        {
            var clientExpr = new[] {
                new SortingInfo {
                    Selector = "Inner.Prop1"
                }
            };

            var targetExpr = Expression.Parameter(typeof(IQueryable <DataItem2>), "data");
            var expr       = new SortExpressionCompiler <DataItem2>(false).Compile(targetExpr, clientExpr);

            Assert.Equal("data.OrderBy(obj => obj.Inner.Prop1)", expr.ToString());
        }
Пример #2
0
 public SortExpressionCompilerTests()
 {
     _compiler   = new SortExpressionCompiler <DataItem1>(false);
     _targetExpr = Expression.Parameter(typeof(IQueryable <DataItem1>), "data");
 }
        public void SortByNestedProp() {
            var clientExpr = new[] {
                new SortingInfo { Selector = "Inner.Prop1" }
            };

            var targetExpr = Expression.Parameter(typeof(IQueryable<DataItem2>), "data");
            var expr = new SortExpressionCompiler<DataItem2>(false).Compile(targetExpr, clientExpr);
            Assert.Equal("data.OrderBy(obj => obj.Inner.Prop1)", expr.ToString());
        }
 public SortExpressionCompilerTests() {
     _compiler = new SortExpressionCompiler<DataItem1>(false);
     _targetExpr = Expression.Parameter(typeof(IQueryable<DataItem1>), "data");
 }