本文整理汇总了C#中ICriteriaQuery.GetColumnAliasesUsingProjection方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.GetColumnAliasesUsingProjection方法的具体用法?C# ICriteriaQuery.GetColumnAliasesUsingProjection怎么用?C# ICriteriaQuery.GetColumnAliasesUsingProjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteriaQuery
的用法示例。
在下文中一共展示了ICriteriaQuery.GetColumnAliasesUsingProjection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlString
/// <summary>
/// Render the SQL fragment
/// </summary>
public virtual string ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
{
string[] columns = criteriaQuery.GetColumnAliasesUsingProjection(criteria, propertyName);
StringBuilder fragment = new StringBuilder();
ISessionFactoryImplementor factory = criteriaQuery.Factory;
for (int i = 0; i < columns.Length; i++)
{
// TODO H3: bool lower = _ignoreCase && type.SqlTypes( factory )[ i ] == Types.VARCHAR
bool lower = false;
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 fragment.ToString();
}
示例2: ToSqlString
/// <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);
StringBuilder fragment = new StringBuilder();
ISessionFactoryImplementor factory = criteriaQuery.Factory;
for (int i = 0; i < columns.Length; i++)
{
// TODO H3: bool lower = _ignoreCase && type.SqlTypes( factory )[ i ] == Types.VARCHAR
bool lower = false;
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());
}