예제 #1
0
        public static string BuildFieldDefinition(this QueryNode node, ConvertProperty convertProperty)
        {
            convertProperty = convertProperty ?? Default;

            var propertyParts = node.Accept(PropertyNameVisitor.Instance).ToArray();
            var propertyName  = convertProperty(propertyParts);

            return(propertyName);
        }
        /// <summary>
        /// Main dispatching visit method for translating query-nodes into expressions.
        /// </summary>
        /// <param name="node">The node to visit/translate.</param>
        /// <param name="joinClause">true if join must be extracted</param>
        /// <returns>The LINQ string resulting from visiting the node.</returns>
        internal string TranslateNode(QueryNode node, bool joinClause = false)
        {
            if (joinClause)//starting
            {
                this.joinClause = joinClause;
            }

            return(node.Accept(this));
        }
예제 #3
0
        public static StringFieldDefinition <T, object> BuildFieldDefinition <T>(this QueryNode node, PropertyCalculator propertyCalculator)
        {
            propertyCalculator = propertyCalculator ?? DefaultCalculator;

            var propertyParts = node.Accept(PropertyNameVisitor.Instance).ToArray();
            var propertyName  = propertyCalculator(propertyParts);

            return(new StringFieldDefinition <T, object>(propertyName));
        }
예제 #4
0
 public virtual void Visit(QueryNode node)
 {
     node.From.Accept(this);
     node.Where?.Accept(this);
     node.Select.Accept(this);
     node.Take?.Accept(this);
     node.Skip?.Accept(this);
     node.GroupBy?.Accept(this);
     node.OrderBy?.Accept(this);
     node.Accept(Visitor);
 }
예제 #5
0
            private string Combine(QueryNode source, string name = null)
            {
                var sourceString = source.Accept(this).FirstOrDefault();

                if (!string.IsNullOrEmpty(sourceString) && BaseString.Length > 0 && sourceString.StartsWith(BaseString))
                {
                    sourceString = sourceString.Substring(BaseString.Length + 1);
                }
                var stringList = (new[] { BaseString, sourceString, name }).Where(s => !string.IsNullOrEmpty(s));

                return(string.Join(_seperator, stringList));
            }
 public void Visit(QueryNode node)
 {
     LoadScope("Query");
     node.From.Accept(this);
     node.Where?.Accept(this);
     node.Select.Accept(this);
     node.Take?.Accept(this);
     node.Skip?.Accept(this);
     node.GroupBy?.Accept(this);
     node.OrderBy?.Accept(this);
     node.Accept(_visitor);
     RestoreScope();
 }
예제 #7
0
        public static StringFieldDefinition <MongoContentEntity, object> Visit(QueryNode node, Schema schema)
        {
            var propertyNames = node.Accept(Instance).ToArray();

            if (propertyNames.Length == 3)
            {
                if (!schema.FieldsByName.TryGetValue(propertyNames[1], out Field field))
                {
                    throw new NotSupportedException();
                }

                propertyNames[1] = field.Id.ToString();
            }

            var propertyName = $"do.{string.Join(".", propertyNames.Skip(1))}";

            return(new StringFieldDefinition <MongoContentEntity, object>(propertyName));
        }
예제 #8
0
        public void Visit(QueryNode node)
        {
            _walker = _walker.NextChild();
            _visitor.SetScope(_walker.Scope);

            node.From.Accept(this);
            node.Where?.Accept(this);
            node.Select.Accept(this);

            node.Take?.Accept(this);
            node.Skip?.Accept(this);
            node.GroupBy?.Accept(this);
            node.OrderBy?.Accept(this);
            node.Accept(_visitor);

            _walker = _walker.Parent();
            _visitor.SetScope(_walker.Scope);
        }
        public void Visit(QueryNode node)
        {
            _walker = _walker.NextChild();
            _visitor.SetScope(_walker.Scope);

            _visitor.SetMethodAccessType(MethodAccessType.ResultQuery);
            _visitor.SetQueryIdentifier(node.From.Alias);

            node.From.Accept(this);
            node.Where?.Accept(this);
            node.Select.Accept(this);

            node.Take?.Accept(this);
            node.Skip?.Accept(this);
            node.GroupBy?.Accept(this);
            node.OrderBy?.Accept(this);
            node.Accept(_visitor);
            _walker = _walker.Parent();
        }
        public void Visit(QueryNode node)
        {
            Query queryState = new Query();
            queryState.QueryNode = node;
            _visitor.SetQuery(queryState);

            node.From?.Accept(this);
            node.Where?.Accept(this);

            node.GroupBy?.Accept(this);
            
            node.Skip?.Accept(this);
            node.Take?.Accept(this);

            node.OrderBy?.Accept(this);

            node.Select.Accept(this);
            node.Accept(_visitor);

            SetQueryPart(QueryPart.None);
        }
예제 #11
0
        public static StringFieldDefinition <MongoContentEntity, object> Visit(QueryNode node, Schema schema)
        {
            var propertyNames = node.Accept(Instance).ToArray();

            if (propertyNames.Length == 3)
            {
                if (!schema.FieldsByName.TryGetValue(propertyNames[1], out Field field))
                {
                    throw new NotSupportedException();
                }

                propertyNames[1] = field.Id.ToString();
            }

            if (char.IsLower(propertyNames[0][0]))
            {
                propertyNames[0] = char.ToUpperInvariant(propertyNames[0][0]) + propertyNames[0].Substring(1);
            }

            var propertyName = string.Join(".", propertyNames);

            return(new StringFieldDefinition <MongoContentEntity, object>(propertyName));
        }
예제 #12
0
 public static PropertyPath Visit(QueryNode node)
 {
     return(new PropertyPath(node.Accept(Instance)));
 }
예제 #13
0
 public static ImmutableList <string> Visit(QueryNode node)
 {
     return(node.Accept(Instance));
 }
예제 #14
0
 public static object Visit(QueryNode node)
 {
     return(node.Accept(Instance));
 }
예제 #15
0
        public static FilterDefinition <MongoContentEntity> Visit(QueryNode node, Schema schema)
        {
            var visitor = new FilterVisitor(schema);

            return(node.Accept(visitor));
        }
예제 #16
0
 /// <summary>
 /// Main dispatching visit method for translating query-nodes into expressions.
 /// </summary>
 /// <param name="node">The node to visit/translate.</param>
 /// <returns>The LINQ string resulting from visiting the node.</returns>
 internal string TranslateNode(QueryNode node)
 {
     return(node.Accept(this));
 }
 /// <summary>
 /// Main dispatching visit method for translating query-nodes into expressions.
 /// </summary>
 /// <param name="node">The node to visit/translate.</param>
 /// <param name="joinClause">true if join must be extracted</param>
 /// <returns>The LINQ string resulting from visiting the node.</returns>
 internal string TranslateNode(QueryNode node, bool joinClause = false)
 {
     this.joinClause |= joinClause;
     return(node.Accept(this));
 }
예제 #18
0
 internal Expression <Func <string, bool> > TranslateNode(QueryNode node)
 {
     Debug.Assert(node != null, "node != null");
     return(node.Accept(this));
 }
예제 #19
0
 public IProjection Visit(QueryNode queryNode)
 {
     return(queryNode.Accept <IProjection>(this));
 }
예제 #20
0
 public ICriterion Visit(QueryNode queryNode)
 {
     return(queryNode.Accept <ICriterion>(this));
 }
예제 #21
0
 /// <summary>
 /// Main dispatching visit method for validating query-nodes.
 /// </summary>
 /// <remarks>
 /// Type references are not validated as nullability is only meaningful in context of the element
 /// Types are validated for each element if the element defines the type (i.e., property, cast, function,...)
 /// </remarks>
 /// <param name="node">The node to visit/translate.</param>
 /// <returns>bool indicating whether or not any errors were found.</returns>
 public bool ValidateNode(QueryNode node)
 {
     return(node.Accept(this));
 }
예제 #22
0
        public static FilterDefinition <T> Visit(QueryNode node, ConvertProperty propertyCalculator, ConvertValue convertValue)
        {
            var visitor = new FilterVisitor <T>(propertyCalculator, convertValue);

            return(node.Accept(visitor));
        }
예제 #23
0
 /// <summary>
 /// Main dispatching visit method for translating query nodes into expressions.
 /// </summary>
 /// <param name="node">The node to visit/translate.</param>
 /// <returns>The LINQ expression resulting from visiting the node.</returns>
 internal Expression TranslateNode(QueryNode node)
 {
     this.CheckArgumentNull(node, "QueryNode");
     return(node.Accept(this));
 }
예제 #24
0
 public Expression TranslateNode(QueryNode node)
 {
     return(node.Accept(this));
 }
예제 #25
0
 public static ClrValue Visit(QueryNode node)
 {
     return(node.Accept(Instance));
 }
예제 #26
0
 public int TranslateNode(QueryNode node)
 {
     return(node.Accept(this));
 }
예제 #27
0
 public static string ToLogString(this QueryNode node)
 {
     return(node.Accept(new QueryNodeToStringVisitor()));
 }
예제 #28
0
 public static FilterNode Visit(QueryNode node)
 {
     return(node.Accept(Instance));
 }
예제 #29
0
 /// <summary>
 /// Main dispatching visit method for translating query-nodes into expressions.
 /// </summary>
 /// <param name="node">The node to visit/translate.</param>
 /// <returns>The LINQ String resulting from visiting the node.</returns>
 internal String TranslateNode(QueryNode node)
 {
     Debug.Assert(node != null, "node != null");
     return(node.Accept(this));
 }
예제 #30
0
        public static FilterDefinition <T> Visit(QueryNode node, PropertyCalculator propertyCalculator)
        {
            var visitor = new FilterVisitor <T>(propertyCalculator);

            return(node.Accept(visitor));
        }