本文整理汇总了C#中NHibernate.Hql.Ast.ANTLR.Tree.FromElement类的典型用法代码示例。如果您正苦于以下问题:C# FromElement类的具体用法?C# FromElement怎么用?C# FromElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FromElement类属于NHibernate.Hql.Ast.ANTLR.Tree命名空间,在下文中一共展示了FromElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromElementFactory
/// <summary>
/// Creates entity from elements.
/// </summary>
/// <param name="fromClause"></param>
/// <param name="origin"></param>
/// <param name="path"></param>
public FromElementFactory(FromClause fromClause, FromElement origin, string path)
{
_fromClause = fromClause;
_origin = origin;
_path = path;
_collection = false;
}
示例2: FromElement
/// <summary>
/// Constructor form used to initialize <see cref="ComponentJoin"/>.
/// </summary>
/// <param name="fromClause">The FROM clause to which this element belongs.</param>
/// <param name="origin">The origin (LHS) of this element.</param>
/// <param name="alias">The alias applied to this element.</param>
protected FromElement(FromClause fromClause,FromElement origin,string alias):this(origin._token)
{
_fromClause = fromClause;
_origin = origin;
_classAlias = alias;
_tableAlias = origin.TableAlias;
base.Initialize(fromClause.Walker);
}
示例3: FromElementType
public FromElementType(FromElement fromElement, IEntityPersister persister, EntityType entityType)
{
_fromElement = fromElement;
_persister = persister;
_entityType = entityType;
var queryable = persister as IQueryable;
if (queryable != null)
fromElement.Text = queryable.TableName + " " + fromElement.TableAlias;
}
示例4: FromElementType
public FromElementType(FromElement fromElement, IEntityPersister persister, EntityType entityType)
{
_fromElement = fromElement;
_persister = persister;
_entityType = entityType;
if (persister != null)
{
fromElement.Text = ((IQueryable)persister).TableName + " " + TableAlias;
}
}
示例5: ComponentJoin
public ComponentJoin(FromClause fromClause, FromElement origin, string alias, string componentPath, ComponentType componentType)
: base(fromClause, origin, alias)
{
this.componentPath = componentPath;
this.componentType = componentType;
componentProperty = StringHelper.Unqualify(componentPath);
fromClause.AddJoinByPathMap(componentPath, this);
InitializeComponentJoin(new ComponentFromElementType(this));
string[] cols = origin.GetPropertyMapping("").ToColumns(TableAlias, componentProperty);
columns = string.Join(", ", cols);
}
示例6: RenderNonScalarIdentifiers
private void RenderNonScalarIdentifiers(FromElement fromElement, int nonscalarSize, int j, ISelectExpression expr, ASTAppender appender)
{
string text = fromElement.RenderIdentifierSelect(nonscalarSize, j);
if (!fromElement.FromClause.IsSubQuery)
{
if (!_scalarSelect && !Walker.IsShallowQuery)
{
//TODO: is this a bit ugly?
expr.Text = text;
}
else
{
appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
}
}
}
示例7: GenerateSyntheticDotNodeForNonQualifiedPropertyRef
IASTNode GenerateSyntheticDotNodeForNonQualifiedPropertyRef(IASTNode property, FromElement fromElement)
{
IASTNode dot = (IASTNode) adaptor.Create(DOT, "{non-qualified-property-ref}");
// TODO : better way?!?
((DotNode)dot).PropertyPath = ((FromReferenceNode)property).Path;
IdentNode syntheticAlias = (IdentNode)adaptor.Create(IDENT, "{synthetic-alias}");
syntheticAlias.FromElement = fromElement;
syntheticAlias.IsResolved = true;
dot.SetFirstChild(syntheticAlias);
dot.AddChild(property);
return dot;
}
示例8: Visit
public void Visit(IASTNode node)
{
// todo : currently expects that the individual with expressions apply to the same sql table join.
// This may not be the case for joined-subclass where the property values
// might be coming from different tables in the joined hierarchy. At some
// point we should expand this to support that capability. However, that has
// some difficulties:
// 1) the biggest is how to handle ORs when the individual comparisons are
// linked to different sql joins.
// 2) here we would need to track each comparison individually, along with
// the join alias to which it applies and then pass that information
// back to the FromElement so it can pass it along to the JoinSequence
if ( node is DotNode )
{
DotNode dotNode = ( DotNode ) node;
FromElement fromElement = dotNode.FromElement;
if ( _referencedFromElement != null )
{
if ( fromElement != _referencedFromElement )
{
throw new HibernateException( "with-clause referenced two different from-clause elements" );
}
}
else
{
_referencedFromElement = fromElement;
_joinAlias = ExtractAppliedAlias( dotNode );
// todo : temporary
// needed because currently persister is the one that
// creates and renders the join fragments for inheritence
// hierarchies...
if ( _joinAlias != _referencedFromElement.TableAlias)
{
throw new InvalidWithClauseException( "with clause can only reference columns in the driving table" );
}
}
}
else if ( node is ParameterNode )
{
ApplyParameterSpecification(((ParameterNode) node).HqlParameterSpecification);
}
else if ( node is IParameterContainer )
{
ApplyParameterSpecifications( ( IParameterContainer ) node );
}
}
示例9: WithClauseVisitor
public WithClauseVisitor(FromElement fromElement)
{
_joinFragment = fromElement;
}
示例10: ResolveCollectionProperty
public void ResolveCollectionProperty(IASTNode expr)
{
String propertyName = CollectionProperties.GetNormalizedPropertyName( _methodName );
if ( expr is FromReferenceNode )
{
FromReferenceNode collectionNode = ( FromReferenceNode ) expr;
// If this is 'elements' then create a new FROM element.
if ( CollectionPropertyNames.Elements == propertyName )
{
HandleElements( collectionNode, propertyName );
}
else {
// Not elements(x)
_fromElement = collectionNode.FromElement;
DataType = _fromElement.GetPropertyType( propertyName, propertyName );
_selectColumns = _fromElement.ToColumns( _fromElement.TableAlias, propertyName, _inSelect );
}
if ( collectionNode is DotNode )
{
PrepareAnyImplicitJoins( ( DotNode ) collectionNode );
}
if ( !_inSelect )
{
_fromElement.Text = "";
_fromElement.UseWhereFragment = false;
}
PrepareSelectColumns( _selectColumns );
Text = _selectColumns[0];
Type = HqlSqlWalker.SQL_TOKEN;
}
else
{
throw new SemanticException(
"Unexpected expression " + expr +
" found for collection function " + propertyName
);
}
}
示例11: AddDuplicateAlias
public void AddDuplicateAlias(string alias, FromElement element)
{
if (alias != null)
{
_fromElementByClassAlias.Add(alias, element);
}
}
示例12: AddJoinByPathMap
public void AddJoinByPathMap(string path, FromElement destination)
{
if (Log.IsDebugEnabled)
{
Log.Debug("addJoinByPathMap() : " + path + " -> " + destination);
}
_fromElementsByPath.Add(path, destination);
}
示例13: SetOrigin
public void SetOrigin(FromElement origin, bool manyToMany)
{
_origin = origin;
origin.AddDestination(this);
if (origin.FromClause == FromClause)
{
// TODO: Figure out a better way to get the FROM elements in a proper tree structure.
// If this is not the destination of a many-to-many, add it as a child of the origin.
if (manyToMany)
{
origin.AddSibling(this);
}
else
{
if (!Walker.IsInFrom && !Walker.IsInSelect)
{
FromClause.AddChild(this);
}
else
{
origin.AddChild(this);
}
}
}
else if (!Walker.IsInFrom)
{
// HHH-276 : implied joins in a subselect where clause - The destination needs to be added
// to the destination's from clause.
FromClause.AddChild(this); // Not sure if this is will fix everything, but it works.
}
else
{
// Otherwise, the destination node was implied by the FROM clause and the FROM clause processor
// will automatically add it in the right place.
}
}
示例14: GetOrigin
private static FromElement GetOrigin(FromElement fromElement)
{
var realOrigin = fromElement.RealOrigin;
if (realOrigin != null)
return realOrigin;
// work around that crazy issue where the tree contains
// "empty" FromElements (no text); afaict, this is caused
// by FromElementFactory.createCollectionJoin()
var origin = fromElement.Origin;
if (origin == null)
throw new QueryException("Unable to determine origin of join fetch [" + fromElement.GetDisplayText() + "]");
return origin;
}
示例15: RenderNonScalarProperties
private static void RenderNonScalarProperties(ASTAppender appender, FromElement fromElement, int nonscalarSize, int k)
{
string text = fromElement.RenderPropertySelect(nonscalarSize, k);
appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
if (fromElement.QueryableCollection != null && fromElement.IsFetch)
{
text = fromElement.RenderCollectionSelectFragment(nonscalarSize, k);
appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
}
// Look through the FromElement's children to find any collections of values that should be fetched...
ASTIterator iter = new ASTIterator(fromElement);
foreach (FromElement child in iter)
{
if (child.IsCollectionOfValuesOrComponents && child.IsFetch)
{
// Need a better way to define the suffixes here...
text = child.RenderValueCollectionSelectFragment(nonscalarSize, nonscalarSize + k);
appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
}
}
}