本文整理汇总了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));
}
示例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());
}