public static TypeContext <S> WalkExpression <T, S>(TypeContext <T> tc, Expression <Func <T, S> > lambda)
        {
            var mag = new MemberAccessGatherer()
            {
                replacements = { { lambda.Parameters[0], new TypeContextExpression(new PropertyInfo[0], typeof(T), tc.PropertyRoute, tc.Value) } }
            };

            TypeContextExpression result = Cast(mag.Visit(lambda.Body));

            var value = result.Value == NonValue ?
                        (S)(object)null :
                        (S)result.Value;

            return(new TypeContext <S>(value, tc, result.Properties.ToString(a => a.Name, TypeContext.Separator), result.Route));
        }
Esempio n. 2
0
 public static TypeContext <S> WalkExpression <T, S>(TypeContext <T> tc, Expression <Func <T, S> > lambda)
 {
     return(MemberAccessGatherer.WalkExpression(tc, lambda));
 }