private static void AnalyzeResourceExpression(LambdaExpression lambda, ResourceExpression resource) { PathBox pb = new PathBox(); ProjectionAnalyzer.Analyze(lambda, pb); resource.Projection = new ProjectionQueryOptionExpression(lambda.Body.Type, lambda, pb.ProjectionPaths.ToList()); resource.ExpandPaths = pb.ExpandPaths.Union(resource.ExpandPaths, StringComparer.Ordinal).ToList(); }
internal override Expression VisitMethodCall(MethodCallExpression m) { if (ProjectionAnalyzer.IsMethodCallAllowedEntitySequence(m)) { ProjectionAnalyzer.CheckChainedSequence(m, this.type); return(base.VisitMethodCall(m)); } if ((m.Object != null ? CommonUtil.IsClientType(m.Object.Type) : false) || m.Arguments.Any(a => CommonUtil.IsClientType(a.Type))) { throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjection, this.type, m.ToString())); } return(base.VisitMethodCall(m)); }
internal override Expression VisitMethodCall(MethodCallExpression m) { /* * if ((m.Object != null && ProjectionAnalyzer.IsDisallowedExpressionForMethodCall(m.Object)) || m.Arguments.Any(a => ProjectionAnalyzer.IsDisallowedExpressionForMethodCall(a))) ||{ || throw new NotSupportedException(string.Format(SR.ALinqExpressionNotSupportedInProjection, this.type, m.ToString())); ||} */ if (ProjectionAnalyzer.IsMethodCallAllowedEntitySequence(m)) { ProjectionAnalyzer.CheckChainedSequence(m, this.type); return(base.VisitMethodCall(m)); } throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjectionToEntity, this.type, m.ToString())); }
internal override Expression VisitMemberInit(MemberInitExpression init) { ProjectionAnalyzer.Analyze(init, this.box); return(init); }
internal override Expression VisitLambda(LambdaExpression lambda) { ProjectionAnalyzer.Analyze(lambda, this.box); return(lambda); }