本文整理汇总了C#中NHibernate.Hql.Ast.ANTLR.Tree.FromElement.SetWithClauseFragment方法的典型用法代码示例。如果您正苦于以下问题:C# FromElement.SetWithClauseFragment方法的具体用法?C# FromElement.SetWithClauseFragment怎么用?C# FromElement.SetWithClauseFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Hql.Ast.ANTLR.Tree.FromElement
的用法示例。
在下文中一共展示了FromElement.SetWithClauseFragment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleWithFragment
private void HandleWithFragment(FromElement fromElement, IASTNode hqlWithNode)
{
try
{
ITreeNodeStream old = input;
input = new CommonTreeNodeStream(adaptor, hqlWithNode);
IASTNode hqlSqlWithNode = (IASTNode) withClause().Tree;
input = old;
if (log.IsDebugEnabled)
{
log.Debug("handleWithFragment() : " + _printer.ShowAsString(hqlSqlWithNode, "-- with clause --"));
}
WithClauseVisitor visitor = new WithClauseVisitor(fromElement);
NodeTraverser traverser = new NodeTraverser(visitor);
traverser.TraverseDepthFirst(hqlSqlWithNode);
FromElement referencedFromElement = visitor.GetReferencedFromElement();
if (referencedFromElement != fromElement)
{
throw new InvalidWithClauseException(
"with-clause expressions did not reference from-clause element to which the with-clause was associated");
}
SqlGenerator sql = new SqlGenerator(_sessionFactoryHelper.Factory, new CommonTreeNodeStream(adaptor, hqlSqlWithNode.GetChild(0)));
sql.whereExpr();
var withClauseFragment = new SqlString("(", sql.GetSQL(), ")");
fromElement.SetWithClauseFragment(visitor.GetJoinAlias(), withClauseFragment);
}
catch (SemanticException)
{
throw;
}
catch (InvalidWithClauseException)
{
throw;
}
catch (Exception e)
{
throw new SemanticException(e.Message);
}
}