public CollectionNotEmptyExpression(ResourceFieldChainExpression targetCollection, FilterExpression filter)
        {
            ArgumentGuard.NotNull(targetCollection, nameof(targetCollection));

            TargetCollection = targetCollection;
            Filter           = filter;
        }
Exemplo n.º 2
0
        public SortElementExpression(ResourceFieldChainExpression targetAttribute, bool isAscending)
        {
            ArgumentGuard.NotNull(targetAttribute, nameof(targetAttribute));

            TargetAttribute = targetAttribute;
            IsAscending     = isAscending;
        }
Exemplo n.º 3
0
 public MatchTextExpression(ResourceFieldChainExpression targetAttribute, LiteralConstantExpression textValue,
                            TextMatchKind matchKind)
 {
     TargetAttribute = targetAttribute ?? throw new ArgumentNullException(nameof(targetAttribute));
     TextValue       = textValue ?? throw new ArgumentNullException(nameof(textValue));
     MatchKind       = matchKind;
 }
        public QueryStringParameterScopeExpression(LiteralConstantExpression parameterName, ResourceFieldChainExpression scope)
        {
            ArgumentGuard.NotNull(parameterName, nameof(parameterName));

            ParameterName = parameterName;
            Scope         = scope;
        }
Exemplo n.º 5
0
        public MatchTextExpression(ResourceFieldChainExpression targetAttribute, LiteralConstantExpression textValue, TextMatchKind matchKind)
        {
            ArgumentGuard.NotNull(targetAttribute, nameof(targetAttribute));
            ArgumentGuard.NotNull(textValue, nameof(textValue));

            TargetAttribute = targetAttribute;
            TextValue       = textValue;
            MatchKind       = matchKind;
        }
Exemplo n.º 6
0
        public EqualsAnyOfExpression(ResourceFieldChainExpression targetAttribute,
                                     IReadOnlyCollection <LiteralConstantExpression> constants)
        {
            TargetAttribute = targetAttribute ?? throw new ArgumentNullException(nameof(targetAttribute));
            Constants       = constants ?? throw new ArgumentNullException(nameof(constants));

            if (constants.Count < 2)
            {
                throw new ArgumentException("At least two constants are required.", nameof(constants));
            }
        }
Exemplo n.º 7
0
        public override QueryExpression PaginationElementQueryStringValue(PaginationElementQueryStringValueExpression expression, TArgument argument)
        {
            if (expression != null)
            {
                ResourceFieldChainExpression newScope = expression.Scope != null?Visit(expression.Scope, argument) as ResourceFieldChainExpression : null;

                var newExpression = new PaginationElementQueryStringValueExpression(newScope, expression.Value);
                return(newExpression.Equals(expression) ? expression : newExpression);
            }

            return(null);
        }
Exemplo n.º 8
0
        private static void ConvertChainToElement(ResourceFieldChainExpression chain, MutableIncludeNode rootNode)
        {
            MutableIncludeNode currentNode = rootNode;

            foreach (var relationship in chain.Fields.OfType <RelationshipAttribute>())
            {
                if (!currentNode.Children.ContainsKey(relationship))
                {
                    currentNode.Children[relationship] = new MutableIncludeNode(relationship);
                }

                currentNode = currentNode.Children[relationship];
            }
        }
Exemplo n.º 9
0
        public override QueryExpression VisitQueryStringParameterScope(QueryStringParameterScopeExpression expression, TArgument argument)
        {
            if (expression != null)
            {
                var newParameterName = Visit(expression.ParameterName, argument) as LiteralConstantExpression;

                ResourceFieldChainExpression newScope = expression.Scope != null?Visit(expression.Scope, argument) as ResourceFieldChainExpression : null;

                var newExpression = new QueryStringParameterScopeExpression(newParameterName, newScope);
                return(newExpression.Equals(expression) ? expression : newExpression);
            }

            return(null);
        }
Exemplo n.º 10
0
 public override QueryExpression VisitResourceFieldChain(ResourceFieldChainExpression expression, TArgument argument)
 {
     return(expression);
 }
 public QueryStringParameterScopeExpression(LiteralConstantExpression parameterName, ResourceFieldChainExpression scope)
 {
     ParameterName = parameterName ?? throw new ArgumentNullException(nameof(parameterName));
     Scope         = scope;
 }
Exemplo n.º 12
0
 public CountExpression(ResourceFieldChainExpression targetCollection)
 {
     TargetCollection = targetCollection ?? throw new ArgumentNullException(nameof(targetCollection));
 }
Exemplo n.º 13
0
 public PaginationElementQueryStringValueExpression(ResourceFieldChainExpression scope, int value)
 {
     Scope = scope;
     Value = value;
 }
Exemplo n.º 14
0
 public EqualsAnyOfExpression(ResourceFieldChainExpression targetAttribute,
                              IReadOnlyCollection <LiteralConstantExpression> constants)
 {
     TargetAttribute = targetAttribute ?? throw new ArgumentNullException(nameof(targetAttribute));
     Constants       = constants ?? throw new ArgumentNullException(nameof(constants));
 }
 public SortElementExpression(ResourceFieldChainExpression targetAttribute, bool isAscending)
 {
     TargetAttribute = targetAttribute ?? throw new ArgumentNullException(nameof(targetAttribute));
     IsAscending     = isAscending;
 }
Exemplo n.º 16
0
        public CountExpression(ResourceFieldChainExpression targetCollection)
        {
            ArgumentGuard.NotNull(targetCollection, nameof(targetCollection));

            TargetCollection = targetCollection;
        }