本文整理汇总了C#中NHibernate.StartsWithCaseInsensitive方法的典型用法代码示例。如果您正苦于以下问题:C# NHibernate.StartsWithCaseInsensitive方法的具体用法?C# NHibernate.StartsWithCaseInsensitive怎么用?C# NHibernate.StartsWithCaseInsensitive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate
的用法示例。
在下文中一共展示了NHibernate.StartsWithCaseInsensitive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLimitString
/// <summary>
/// Return customized limit string (for paging queries)
/// For performance reason the limit string is ommitted when querying the first page.
/// </summary>
/// <param name="querySqlString"></param>
/// <param name="offset"></param>
/// <param name="last"></param>
/// <returns></returns>
public override NHibernate.SqlCommand.SqlString GetLimitString(NHibernate.SqlCommand.SqlString querySqlString, int offset, int last)
{
if (!querySqlString.StartsWithCaseInsensitive("select "))
{
throw new ArgumentException("querySqlString should start with select", "querySqlString");
}
SqlString sqlString = querySqlString.Substring(6);
string orderSql = querySqlString.SubstringStartingWithLast("order by").ToString();
if (orderSql.Length != 0)
{
sqlString = sqlString.Substring(0, (sqlString.Length - orderSql.Length) - 1);
}
SqlStringBuilder builder = new SqlStringBuilder();
int num = offset + 1;
builder.Add("SELECT TOP ").Add(last.ToString()).Add(" ").Add(sqlString);
if(offset > 0)
builder.Add(" WITH FIRSTROW ").Add(num.ToString());
if (orderSql.Length > 0)
{
builder.Add(" ").Add(orderSql);
}
return builder.ToSqlString();
}