internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;
            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) ||
              /* TODO Fix ME !  CommonUtil.IsClientType(le.Parameters[0].Type) || */
                !le.Parameters[0].Type.GetProperties().Any(p => p.PropertyType == proposedParameterType))
            {
                result = le;
            }
            else
            {
                ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);
                result = rewriter.Rebind(le);
            }

            return result;
        }
Ejemplo n.º 2
0
        internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;

            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) ||
                /* TODO Fix ME !  CommonUtil.IsClientType(le.Parameters[0].Type) || */
                !le.Parameters[0].Type.GetProperties().Any(p => p.PropertyType == proposedParameterType))
            {
                result = le;
            }
            else
            {
                ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);
                result = rewriter.Rebind(le);
            }

            return(result);
        }