public JoinOperatorConcept()
 {
     TableReference = new TableConcept()
     {
         Parent = this
     };
     Predicate = new WhereConcept()
     {
         Parent = this
     };
 }
Пример #2
0
        public IEnumerable <ISyntaxNode> Scope(ISyntaxNode concept, string propertyName)
        {
            List <ISyntaxNode> scope = new List <ISyntaxNode>();

            if (!(concept.Ancestor <SelectConcept>() is SelectConcept select))
            {
                return(scope);
            }
            if (select.FROM == null)
            {
                return(scope);
            }
            if (select.FROM.Expressions == null)
            {
                return(scope);
            }
            if (select.FROM.Expressions.Count == 0)
            {
                return(scope);
            }

            foreach (var expression in select.FROM.Expressions)
            {
                TableConcept table = null;
                if (expression is TableConcept)
                {
                    table = (TableConcept)expression;
                }
                else if (expression is JoinOperatorConcept)
                {
                    table = ((JoinOperatorConcept)expression).TableReference;
                }
                if (table == null)
                {
                    continue;
                }
                if (table.TableDefinition == null)
                {
                    continue;
                }

                foreach (PropertyInfo property in table.TableDefinition.GetProperties())
                {
                    scope.Add(new ColumnConcept()
                    {
                        Parent         = concept,
                        Name           = property.Name,
                        TableReference = table
                    });
                }
            }
            return(scope);
        }