private void FlattenGroupBy(List <SqlExpression> exprs) { List <SqlExpression> list = new List <SqlExpression>(exprs.Count); foreach (SqlExpression gex in exprs) { if (TypeSystem.IsSequenceType(gex.ClrType)) { throw Error.InvalidGroupByExpressionType(gex.ClrType.Name); } this.FlattenGroupByExpression(list, gex); } exprs.Clear(); exprs.AddRange(list); }
internal override Expression VisitMemberAccess(MemberExpression m) { if (MetaPosition.AreSameMember(m.Member, this.association.ThisMember.Member)) { Expression[] keyValues = GetKeyValues(this.Visit(m.Expression), this.association.ThisKey); return(WhereClauseFromSourceAndKeys(this.otherSouce, this.association.OtherKey.ToArray(), keyValues)); } Expression exp = this.Visit(m.Expression); if (exp != m.Expression) { if (exp.Type != m.Expression.Type && m.Member.Name == "Count" && TypeSystem.IsSequenceType(exp.Type)) { return(Expression.Call(typeof(Enumerable), "Count", new Type[] { TypeSystem.GetElementType(exp.Type) }, exp)); } return(Expression.MakeMemberAccess(exp, m.Member)); } return(m); }