void LookupAlias(IASTNode aliasRef) { FromElement alias = _currentFromClause.GetFromElement(aliasRef.Text); FromReferenceNode aliasRefNode = (FromReferenceNode)aliasRef; aliasRefNode.FromElement = alias; }
protected IASTNode LookupProperty(IASTNode dot, bool root, bool inSelect) { DotNode dotNode = (DotNode)dot; FromReferenceNode lhs = dotNode.GetLhs(); IASTNode rhs = lhs.NextSibling; switch (rhs.Type) { case ELEMENTS: case INDICES: if (log.IsDebugEnabled) { log.Debug("lookupProperty() " + dotNode.Path + " => " + rhs.Text + "(" + lhs.Path + ")"); } CollectionFunction f = (CollectionFunction)rhs; // Re-arrange the tree so that the collection function is the root and the lhs is the path. f.SetFirstChild(lhs); lhs.NextSibling = null; dotNode.SetFirstChild(f); Resolve(lhs); // Don't forget to resolve the argument! f.Resolve(inSelect); // Resolve the collection function now. return(f); default: // Resolve everything up to this dot, but don't resolve the placeholders yet. dotNode.ResolveFirstChild(); return(dotNode); } }
static void ResolveSelectExpression(IASTNode node) { // This is called when it's time to fully resolve a path expression. int type = node.Type; switch (type) { case DOT: DotNode dot = (DotNode)node; dot.ResolveSelectExpression(); break; case ALIAS_REF: // Notify the FROM element that it is being referenced by the select. FromReferenceNode aliasRefNode = (FromReferenceNode)node; aliasRefNode.Resolve(false, false); //TODO: is it kosher to do it here? FromElement fromElement = aliasRefNode.FromElement; if (fromElement != null) { fromElement.IncludeSubclasses = true; } break; default: break; } }
private IQueryable ResolveEntityJoinReferencedPersister(FromReferenceNode path) { string entityName = path.Path; var persister = SessionFactoryHelper.FindQueryableUsingImports(entityName); if (persister == null && entityName != null) { var implementors = SessionFactoryHelper.Factory.GetImplementors(entityName); //Possible case - join on interface if (implementors.Length == 1) { persister = (IQueryable)SessionFactoryHelper.Factory.TryGetEntityPersister(implementors[0]); } } if (persister != null) { return(persister); } if (path.Type == IDENT) { throw new QuerySyntaxException(entityName + " is not mapped"); } //Keep old exception for DOT node throw new InvalidPathException("Invalid join: " + entityName); }