本文整理汇总了C#中IASTNode.Where方法的典型用法代码示例。如果您正苦于以下问题:C# IASTNode.Where方法的具体用法?C# IASTNode.Where怎么用?C# IASTNode.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IASTNode
的用法示例。
在下文中一共展示了IASTNode.Where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public void Visit(IASTNode node)
{
if (node.Type == HqlSqlWalker.FROM)
{
_nodes.AddRange(node.Where(child => child.Type == HqlSqlWalker.RANGE).Select(range => range.GetChild(0)));
}
}
示例2: AddImpliedFromToQuery
/// <summary>
/// Handles HQL AST transformation for collection filters (which are created with <see cref="ISession.CreateFilter"/>).
///
/// Adds FROM elements to implicit FROM clause.
/// E.g.,
/// <code>
/// ( query ( SELECT_FROM {filter-implied FROM} ) ( where ( = X 10 ) ) )
/// </code>
/// gets converted to
/// <code>
/// ( query ( SELECT_FROM ( FROM NHibernate.DomainModel.Many this ) ) ( where ( = X 10 ) ) )
/// </code>
/// </summary>
/// <param name="ast">The root node of HQL query</param>
/// <param name="collectionRole">Collection that is being filtered</param>
/// <param name="factory">Session factory</param>
internal static void AddImpliedFromToQuery(IASTNode ast, string collectionRole, ISessionFactoryImplementor factory)
{
if (ast.Type != HqlParser.QUERY)
{
var msg = string.Format(CultureInfo.InvariantCulture,
"invalid query type for collection filtering: expected {0}, got {1}", HqlParser.tokenNames[HqlParser.QUERY], HqlParser.tokenNames[ast.Type]);
throw new QueryException(msg);
}
var selectFromClause = ast.Where(x => x.Type == HqlParser.SELECT_FROM).Single();
var fromClause = selectFromClause.Where(x => x.Type == HqlParser.FROM).Single();
fromClause.Text = "FROM"; // Just for prettier debug output
AddImpliedFromToFromNode(fromClause, collectionRole, factory);
}