Esempio n. 1
0
        public static MemberInfo[] GetMemberPath(Expression expression)
        {
            var memberVisitor = new MemberVisitor();

            memberVisitor.Visit(expression);
            return(memberVisitor.MemberPath.ToArray());
        }
Esempio n. 2
0
 private MemberPaths GetMemberPaths <TResult>(Expression <Func <TResult, object> >[] membersToExpand)
 {
     return(membersToExpand.Select(expr =>
     {
         var visitor = new MemberVisitor();
         visitor.Visit(expr);
         return visitor.MemberPath;
     }));
 }
Esempio n. 3
0
        public IQueryable <TResult> To <TResult>(object parameters = null, params Expression <Func <TResult, object> >[] membersToExpand)
        {
            var members = membersToExpand.Select(expr =>
            {
                var visitor = new MemberVisitor();
                visitor.Visit(expr);
                return(visitor.MemberName);
            })
                          .ToArray();

            return(To <TResult>(parameters, members));
        }
Esempio n. 4
0
        public IQueryable <TResult> To <TResult>(System.Collections.Generic.IDictionary <string, object> parameters, params Expression <Func <TResult, object> >[] membersToExpand)
        {
            var members = membersToExpand.Select(expr =>
            {
                var visitor = new MemberVisitor();
                visitor.Visit(expr);
                return(visitor.MemberName);
            })
                          .ToArray();

            return(_source.Select(_mappingEngine.CreateMapExpression <TSource, TResult>(parameters, members)));
        }
Esempio n. 5
0
        public IQueryable <TResult> To <TResult>(System.Collections.Generic.IDictionary <string, object> parameters, params Expression <Func <TResult, object> >[] membersToExpand)
        {
            var members = membersToExpand.Select(expr =>
            {
                var visitor = new MemberVisitor();
                visitor.Visit(expr);
                return(visitor.MemberName);
            })
                          .ToArray();

            var mapExpr = _mappingEngine.CreateMapExpression(_source.ElementType, typeof(TResult), parameters, members);

            return(_source.Provider.CreateQuery <TResult>(
                       Expression.Call(
                           null,
                           QueryableSelectMethod.MakeGenericMethod(_source.ElementType, typeof(TResult)),
                           new[] { _source.Expression, Expression.Quote(mapExpr) }
                           )
                       ));
        }
 public static MemberPaths GetMemberPaths <TResult>(Expression <Func <TResult, object> >[] membersToExpand) =>
 membersToExpand.Select(expr => MemberVisitor.GetMemberPath(expr));