/// <summary>
 /// 写入查询数据源子句。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="sources">数据源集合。</param>
 protected virtual void WriteFragmentForFrom(SqlWriter writer, IEnumerable <ISourceFragment> sources)
 {
     if (sources.Any())
     {
         writer.WriteLine();
         writer.Write("FROM ");
         sources.ForEach(() => writer.WriteLine(),
                         source => WriteFragmentForSource(writer, source));
     }
 }
 /// <summary>
 /// 写入过滤条件。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="where">过滤条件。</param>
 protected virtual void WriteFragmentForWhere(SqlWriter writer, ILogicFragment where)
 {
     if (where != null)
     {
         writer.WriteLine();
         writer.Write("WHERE ");
         where.WriteSql(writer);
     }
 }
 /// <summary>
 /// 写入分组语句。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="groups">分组语句集合。</param>
 protected virtual void WriteFragmentForGroupBy(SqlWriter writer, IEnumerable <ISqlFragment> groups)
 {
     if (groups.Any())
     {
         writer.WriteLine();
         writer.Write("GROUP BY ");
         groups.ForEach(() => writer.Write(", "), item => item.WriteSql(writer));
     }
 }
 /// <summary>
 /// 写入排序语句。
 /// </summary>
 /// <param name="writer">语句写入器。</param>
 /// <param name="sorts">排序语句集合。</param>
 protected virtual void WriteFragmentForOrderBy(SqlWriter writer, IEnumerable <IExpressionFragment> sorts)
 {
     if (sorts.Any())
     {
         writer.WriteLine();
         writer.Write("ORDER BY ");
         sorts.ForEach(() => writer.Write(", "), sort => sort.WriteSql(writer));
     }
 }