public IDetachedQuery SetParameterList(string name, ICollection vals, Type.IType type) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name", "Is null or empty."); } namedListParams[name] = new TypedValue(type, vals, EntityMode.Poco); return(this); }
/// <summary> /// Render the SQL fragment /// </summary> public virtual SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery) { if (projection != null) { SqlString sb = new SqlString(); SqlString produced = this.projection.ToSqlString(criteria, 0, criteriaQuery, new Dictionary <string, IFilter>()); SqlString truncated = NHibernate.Util.StringHelper.RemoveAsAliasesFromSql(produced); sb = sb.Append(truncated); sb = sb.Append(ascending ? " asc" : " desc"); return(sb); } string[] columns = criteriaQuery.GetColumnAliasesUsingProjection(criteria, propertyName); Type.IType type = criteriaQuery.GetTypeUsingProjection(criteria, propertyName); StringBuilder fragment = new StringBuilder(); ISessionFactoryImplementor factory = criteriaQuery.Factory; for (int i = 0; i < columns.Length; i++) { bool lower = ignoreCase && IsStringType(type.SqlTypes(factory)[i]); if (lower) { fragment.Append(factory.Dialect.LowercaseFunction) .Append("("); } fragment.Append(columns[i]); if (lower) { fragment.Append(")"); } fragment.Append(ascending ? " asc" : " desc"); if (i < columns.Length - 1) { fragment.Append(", "); } } return(new SqlString(fragment.ToString())); }
public IDetachedQuery SetParameter(int position, object val, Type.IType type) { posParams[position] = new TypedValue(type, val, EntityMode.Poco); return(this); }