當前位置: 首頁>>代碼示例>>C#>>正文


C# HqlTreeBuilder.GreaterThan方法代碼示例

本文整理匯總了C#中NHibernate.Hql.Ast.HqlTreeBuilder.GreaterThan方法的典型用法代碼示例。如果您正苦於以下問題:C# HqlTreeBuilder.GreaterThan方法的具體用法?C# HqlTreeBuilder.GreaterThan怎麽用?C# HqlTreeBuilder.GreaterThan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Hql.Ast.HqlTreeBuilder的用法示例。


在下文中一共展示了HqlTreeBuilder.GreaterThan方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BuildHql

		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
		{
			// Instance CompareTo() or static string.Compare()?
			Expression lhs = arguments.Count == 1 ? targetObject : arguments[0];
			Expression rhs = arguments.Count == 1 ? arguments[0] : arguments[1];

			HqlExpression lhs1 = visitor.Visit(lhs).AsExpression();
			HqlExpression rhs1 = visitor.Visit(rhs).AsExpression();
			HqlExpression lhs2 = visitor.Visit(lhs).AsExpression();
			HqlExpression rhs2 = visitor.Visit(rhs).AsExpression();

			// CASE WHEN (table.[Name] = N'Foo') THEN 0
			//      WHEN (table.[Name] > N'Foo') THEN 1
			//      ELSE -1 END

			return treeBuilder.Case(
				new[]
					{
						treeBuilder.When(treeBuilder.Equality(lhs1, rhs1), treeBuilder.Constant(0)),
						treeBuilder.When(treeBuilder.GreaterThan(lhs2, rhs2), treeBuilder.Constant(1))
					},
				treeBuilder.Constant(-1));
		}
開發者ID:prime,項目名稱:nshibernate,代碼行數:23,代碼來源:CompareGenerator.cs

示例2: BuildHql

 public override HqlTreeNode BuildHql(System.Reflection.MethodInfo method, Expression targetObject, System.Collections.ObjectModel.ReadOnlyCollection<Expression> arguments,
    HqlTreeBuilder treeBuilder,IHqlExpressionVisitor visitor)
 {
     return treeBuilder.GreaterThan(
       visitor.Visit(arguments[0]).AsExpression(),
     visitor.Visit(arguments[1]).AsExpression());
 }
開發者ID:alittletired,項目名稱:SolutionPlatform,代碼行數:7,代碼來源:StringCompareGenerator.cs


注:本文中的NHibernate.Hql.Ast.HqlTreeBuilder.GreaterThan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。