public QueryMap(Expression <Func <object> > expression, string alias, QueryTable queryTable) { Table = queryTable; if (alias == null) { throw new ArgumentNullException(nameof(alias)); } Expression = expression; Alias = alias; }
public QueryJoin(Expression <Func <bool> > on, QueryTable queryTable) { QueryTable = queryTable; On = @on; }
public QueryTree.SelectExpression Parse(QueryTable queryTable, bool isSubQuery = false) { var ex = new QueryTree.SelectExpression { Values = queryTable.Maps.Select(x => new QueryTree.AliasedExpression { Alias = x.Alias, Expression = _binaryParser.Parse(x.Expression) }).ToList() }; if (!isSubQuery && ex.Values.Count == 0) { ex.Values = queryTable.Mapping.Maps.Select(x => new QueryTree.AliasedExpression { Alias = x.ColumnName, Expression = new QueryTree.ColumnExpression { Column = x.ColumnName, TableAlias = queryTable.Alias }, MapMapping = x }).ToList(); } ex.From = new QueryTree.FromExpression { Table = new QueryTree.TableExpression { TableAlias = queryTable.Alias, Table = queryTable.Mapping.TableName } }; foreach (var j in queryTable.Joins) { if (j.QueryTable.Maps.Count > 0 || j.QueryTable.Joins.Count > 0) { ex.Join.Add(new QueryTree.JoinExpression { Alias = new QueryTree.TableAliasExpression { Alias = j.QueryTable.Alias }, On = _binaryParser.Parse(j.On), Table = Parse(j.QueryTable) }); } else { ex.Join.Add(new QueryTree.JoinExpression { Alias = new QueryTree.TableAliasExpression { Alias = j.QueryTable.Alias }, On = _binaryParser.Parse(j.On), Table = new QueryTree.TableExpression { TableAlias = j.QueryTable.Alias, Table = j.QueryTable.Mapping.TableName } }); } foreach (var w in queryTable.Wheres) { ex.Where.Add(_binaryParser.Parse(w.Where)); } } return(ex); }
private void Join <T>(QueryTable <T> queryTable, Expression <Func <T, bool> > @on) { FromTable.Join(queryTable, on); }
public Query <TEntity> Join <T>(QueryTable <T> queryTable, Expression <Func <bool> > on) { FromTable.Join(queryTable, on); return(this); }
protected Query(EntityMapping @from, IMascisSession session) { Session = session; _tableCounter = 0; FromTable = new QueryTable <TEntity>("t" + _tableCounter++, @from, session); }
public QueryTableReferenceInterceptor(QueryTable queryTable) { _queryTable = queryTable; }