Beispiel #1
0
        public static IQueryable <T> ApplyFilters <T>(this IQueryable <T> query, IHaveFilters filtersContainer)
        {
            Ensure.That(query, nameof(query)).IsNotNull();
            Ensure.That(filtersContainer, nameof(filtersContainer)).IsNotNull();

            return(query.ApplyFilter(FiltersConverterService.Convert <T>(filtersContainer)));
        }
Beispiel #2
0
        public static FilterNode Convert <TFilteredEntity>(IHaveFilters filtersContainer)
        {
            Ensure.That(filtersContainer, nameof(filtersContainer)).IsNotNull();

            return(filtersContainer.Filters == null || filtersContainer.Filters.Any() == false
                ? null
                : new FilterGroup(Logic.And, filtersContainer.Filters.Select(ConvertToFilterNode <TFilteredEntity>)));
        }