Example #1
0
        internal static Expression <Func <TContainer, bool> > ComposeContainerProperty <TContainer, TProperty>(
            Expression <Func <TProperty, bool> > predicate,
            string propertyName)
        {
            var parameterExpression = Expression.Parameter(typeof(TContainer), "x");
            var propertyExpression  = Expression.Property(parameterExpression, propertyName);
            var rewriter            = new PredicateRewriter()
            {
                NewExpression = propertyExpression
            };

            var newBody = rewriter.Visit(predicate.Body);

            return(Expression.Lambda <Func <TContainer, bool> >(newBody, new[] { parameterExpression }));
        }
Example #2
0
 public IQueryable <ModelBuildAttempt> Filter(IQueryable <ModelBuildAttempt> query) =>
 Filter(
     query,
     x => PredicateRewriter.ComposeContainerProperty <ModelBuildAttempt, ModelBuild>(x, nameof(ModelBuildAttempt.ModelBuild)));
Example #3
0
 public IQueryable <ModelTimelineIssue> Filter(IQueryable <ModelTimelineIssue> query) =>
 Filter(
     query,
     x => PredicateRewriter.ComposeContainerProperty <ModelTimelineIssue, ModelBuild>(x, nameof(ModelTimelineIssue.ModelBuild)));