Пример #1
0
 /// <summary>
 /// Builds the given query, appending results to the given string buffer, and adding all query parameter values
 /// that are used to the map provided.
 /// </summary>
 /// <param name="sb">String builder to which the query will be appended.</param>
 /// <param name="queryParamValues">
 /// Map to which name and values of parameters used in the query should be added.
 /// <code>null</code> is allowed if no additional parameters are to be added.
 /// </param>
 public void Build(StringBuilder sb, IDictionary <string, object> queryParamValues)
 {
     sb.Append("select ");
     sb.Append(_projections.Count > 0
                                                   ? string.Join(", ", _projections.ToArray())
                                                   : string.Join(", ", aliasList().ToArray()));
     sb.Append(" from ");
     // all from entities with aliases, separated with commas
     sb.Append(string.Join(", ", fromList().ToArray()));
     // where part - rootParameters
     if (!RootParameters.IsEmpty())
     {
         sb.Append(" where ");
         RootParameters.Build(sb, queryParamValues);
     }
     // orders
     if (_orders.Count > 0)
     {
         sb.Append(" order by ");
         sb.Append(string.Join(", ", orderList().ToArray()));
     }
 }