/// <summary> /// Renders the query to the given text writer. /// </summary> /// <param name="writer"></param> /// <param name="args"></param> protected void RenderInternal(SqlTextWriter writer, SqlBuildArguments args) { writer.RenderSelect(this.Columns, args, this.SelectDistinct); writer.RenderFrom(this.Table, args); if (this.Joins.Count > 0) { writer.RenderJoins(this.Joins, args); } writer.RenderWhere(this.Filters, SqlLogic.And, args); if (this.Columns.Count(x => x.IsAggregate) > 0) { writer.RenderGroupBy(this.Columns.Where(x => !x.IsAggregate), args); } writer.RenderOrderBy(this.OrderBy, args); if (this.PagingOptions.HasValue) { writer.RenderOffsetLimit(this.PagingOptions.Value, args); } }