Exemplo n.º 1
0
        /// <summary>
        /// Parses all children of the method
        /// </summary>
        /// <param name="method"></param>
        /// <returns></returns>
        protected List<IParsedQuery> ParseChildren(IMethod method) {
            List<IParsedQuery> children = new List<IParsedQuery>();

            foreach (Method child in method.Where(child => child is Method)) {
                IParsedQuery parsedChild = new ParsedQuery();

                this.Parse(child, parsedChild);

                children.Add(parsedChild);
            }

            return children;
        }
Exemplo n.º 2
0
        public override ISerializer Parse(IMethod method, IParsedQuery parsed) {
            parsed.Root = method;

            parsed.Children = this.ParseChildren(method);

            parsed.Methods = this.ParseMethod(method);

            parsed.Skip = this.ParseSkip(method);

            parsed.Limit = this.ParseLimit(method);

            parsed.Databases = this.ParseDatabases(method);

            parsed.Indices = this.ParseIndices(method);

            parsed.Fields = this.ParseFields(method);
            parsed.Fields.AddRange(method.Where(statement => statement is Assignment).SelectMany(this.ParseFields));

            parsed.Values = method.Where(statement => statement is Assignment).SelectMany(this.ParseValues).ToList();

            parsed.Assignments = this.ParseAssignments(method);

            parsed.Conditions = this.ParseConditions(method);

            parsed.Collections = this.ParseCollections(method);

            parsed.Sortings = this.ParseSortings(method);

            return this;
        }