Example #1
0
        protected virtual FilterExpression GetFilter(IReadOnlyCollection <QueryExpression> expressionsInScope, ResourceContext resourceContext)
        {
            ArgumentGuard.NotNull(expressionsInScope, nameof(expressionsInScope));
            ArgumentGuard.NotNull(resourceContext, nameof(resourceContext));

            FilterExpression[] filters = expressionsInScope.OfType <FilterExpression>().ToArray();

            FilterExpression filter = filters.Length > 1 ? new LogicalExpression(LogicalOperator.And, filters) : filters.FirstOrDefault();

            return(_resourceDefinitionAccessor.OnApplyFilter(resourceContext.ResourceType, filter));
        }
Example #2
0
        protected virtual FilterExpression GetFilter(IReadOnlyCollection <QueryExpression> expressionsInScope, ResourceContext resourceContext)
        {
            if (expressionsInScope == null)
            {
                throw new ArgumentNullException(nameof(expressionsInScope));
            }
            if (resourceContext == null)
            {
                throw new ArgumentNullException(nameof(resourceContext));
            }

            var filters = expressionsInScope.OfType <FilterExpression>().ToArray();
            var filter  = filters.Length > 1 ? new LogicalExpression(LogicalOperator.And, filters) : filters.FirstOrDefault();

            filter = _resourceDefinitionAccessor.OnApplyFilter(resourceContext.ResourceType, filter);
            return(filter);
        }