コード例 #1
0
ファイル: ProjectionRewriter.cs プロジェクト: nickchal/pash
 internal static LambdaExpression TryToRewrite(LambdaExpression le, ResourceExpression source)
 {
     Type proposedParameterType = source.ResourceType;
     if ((!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) || ClientTypeUtil.TypeOrElementTypeIsEntity(le.Parameters[0].Type)) || !le.Parameters[0].Type.GetProperties().Any<PropertyInfo>(p => (p.PropertyType == proposedParameterType)))
     {
         return le;
     }
     ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);
     return rewriter.Rebind(le, source);
 }
コード例 #2
0
        internal static LambdaExpression TryToRewrite(LambdaExpression le, ResourceExpression source)
        {
            Type proposedParameterType = source.ResourceType;

            if ((!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) || ClientTypeUtil.TypeOrElementTypeIsEntity(le.Parameters[0].Type)) || !le.Parameters[0].Type.GetProperties().Any <PropertyInfo>(p => (p.PropertyType == proposedParameterType)))
            {
                return(le);
            }
            ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);

            return(rewriter.Rebind(le, source));
        }
コード例 #3
0
ファイル: ProjectionRewriter.cs プロジェクト: nlhepler/mono
        internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;
            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) ||                ClientType.CheckElementTypeIsEntity(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;
        }
コード例 #4
0
        internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;

            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) || ClientType.CheckElementTypeIsEntity(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);
        }
コード例 #5
0
        internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;
            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) ||  // can only rewrite single parameter Lambdas.
                ClientType.CheckElementTypeIsEntity(le.Parameters[0].Type) || // only attempt to rewrite if lambda parameter is not an entity type
                !(le.Parameters[0].Type.GetProperties().Any(p => p.PropertyType == proposedParameterType))) // lambda parameter must have public property that is same as proposed type.
            {
                result = le;
            }
            else
            {
                ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);
                result = rewriter.Rebind(le);
            }

            return result;
        }
コード例 #6
0
ファイル: ProjectionRewriter.cs プロジェクト: ash2005/z
        internal static LambdaExpression TryToRewrite(LambdaExpression le, Type proposedParameterType)
        {
            LambdaExpression result;

            if (!ResourceBinder.PatternRules.MatchSingleArgumentLambda(le, out le) ||                       // can only rewrite single parameter Lambdas.
                ClientType.CheckElementTypeIsEntity(le.Parameters[0].Type) ||                               // only attempt to rewrite if lambda parameter is not an entity type
                !(le.Parameters[0].Type.GetProperties().Any(p => p.PropertyType == proposedParameterType))) // lambda parameter must have public property that is same as proposed type.
            {
                result = le;
            }
            else
            {
                ProjectionRewriter rewriter = new ProjectionRewriter(proposedParameterType);
                result = rewriter.Rebind(le);
            }

            return(result);
        }