public void RegisterTable(TableDeclarationClause declaration) { QueryRoot queryRoot; if (queryTables.TryGetValue(declaration, out queryRoot)) { return; } var queryEntity = CreateQueryEntity(null, declaration.Name); queryRoot = new QueryRoot(queryEntity, declaration); queryTables.Add(declaration, queryRoot); }
public void RegisterSubquery(SubqueryTable clause) { QueryRoot queryRoot; if (queryTables.TryGetValue(clause, out queryRoot)) { return; } var subqueryProperties = CreateSubqueryProperties(clause.Query.Query.Unions.First().SelectClause); var mapping = new TableMapping(clause.Alias, clause.Alias, TableType.Main, subqueryProperties); var queryEntity = new QueryEntity(mapping, null); queryRoot = new QueryRoot(queryEntity, clause); queryTables.Add(clause, queryRoot); }
private void AddColumns(QueryRoot root, SelectClause target) { foreach (var f in root.fields.Values) { var expression = GetFieldExpression(f, target); if (f.invert) { expression = new QueryFunctionExpression { KnownFunction = KnownQueryFunction.SqlNot, Arguments = new List <ISqlElement> { expression } } } ; target.Fields.Add(new SelectFieldExpression { Expression = expression, Alias = f.alias }); } }
public List <QueryEntityProperty> GetProperties(QueryRoot queryRoot, string[] propertyNames) { var enumerator = new PropertiesEnumerator(propertyNames, queryRoot, this); return(enumerator.Enumerate()); }
public PropertiesEnumerator(string[] propertyNames, QueryRoot queryRoot, QueryEntityTree queryEntityTree) { this.propertyNames = propertyNames; this.queryRoot = queryRoot; this.queryEntityTree = queryEntityTree; }
public PropertiesEnumerator(string[] propertyNames, QueryRoot queryRoot, QueryEntityAccessor queryEntityAccessor) { this.propertyNames = propertyNames; this.queryRoot = queryRoot; this.queryEntityAccessor = queryEntityAccessor; }