public override IValue interpret(Context context) { IType sourceType = source.check(context); if (!(sourceType is IterableType)) { throw new InternalError("Illegal source type: " + sourceType.GetTypeName()); } IType itemType = ((IterableType)sourceType).GetItemType(); IValue value = source.interpret(context); if (value == null) { throw new NullReferenceError(); } if (!(value is IFilterable)) { throw new InternalError("Illegal fetch source: " + source); } IFilterable list = (IFilterable)value; ArrowExpression arrow = predicate.ToArrowExpression(); Predicate <IValue> filter = arrow.GetFilter(context, itemType); return(list.Filter(filter)); }
public IQueryable <TModel> Query <TEntity, TModel>(IFilterable <TEntity> searchModel) where TEntity : class { var query = _repository.Query <TEntity>(); query = searchModel.Filter(query); return(query.AsQuery <TEntity, TModel>()); }
public static IQueryable <T> Filter <T>(this IQueryable <T> input, IFilterable <T> filter) { return(filter.Filter(input)); }