コード例 #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);
        }
コード例 #2
0
        /// <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));
            }
コード例 #6
0
 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);
        }
コード例 #9
0
        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();
        }
コード例 #10
0
        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
ファイル: PropertyPathVisitor.cs プロジェクト: seamys/squidex
 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));
 }
コード例 #17
0
 /// <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
ファイル: ExtensionMethods.cs プロジェクト: EricCote/WebApi2
 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));
        }