本文整理汇总了C#中NHibernate.Hql.Classic.QueryTranslator.GetPathAlias方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTranslator.GetPathAlias方法的具体用法?C# QueryTranslator.GetPathAlias怎么用?C# QueryTranslator.GetPathAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Hql.Classic.QueryTranslator
的用法示例。
在下文中一共展示了QueryTranslator.GetPathAlias方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Token
public void Token(string token, QueryTranslator q)
{
if (token != null)
{
path.Append(token);
}
string alias = q.GetPathAlias(path.ToString());
if (alias != null)
{
Reset(q); //reset the dotcount (but not the path)
currentName = alias; //after reset!
currentPropertyMapping = q.GetPropertyMapping(currentName);
if (!ignoreInitialJoin)
{
JoinSequence ojf = q.GetPathJoin(path.ToString());
try
{
joinSequence.AddCondition(ojf.ToJoinFragment(q.EnabledFilters, true).ToWhereFragmentString); //after reset!
}
catch (MappingException me)
{
throw new QueryException(me);
}
// we don't need to worry about any condition in the ON clause
// here (toFromFragmentString), since anything in the ON condition
// is already applied to the whole query
}
}
else if (".".Equals(token))
{
dotcount++;
}
else
{
if (dotcount == 0)
{
if (!continuation)
{
if (!q.IsName(token))
{
throw new QueryException("undefined alias or unknown mapping: " + token);
}
currentName = token;
currentPropertyMapping = q.GetPropertyMapping(currentName);
}
}
else if (dotcount == 1)
{
if (currentName != null)
{
currentProperty = token;
}
else if (collectionName != null)
{
//IQueryableCollection p = q.GetCollectionPersister( collectionRole );
//DoCollectionProperty( token, p, collectionName );
continuation = false;
}
else
{
throw new QueryException("unexpected");
}
}
else
{
// dotcount>=2
// Do the corresponding RHS
IType propertyType = PropertyType;
if (propertyType == null)
{
throw new QueryException("unresolved property: " + currentProperty);
}
if (propertyType.IsComponentType)
{
DereferenceComponent(token);
}
else if (propertyType.IsEntityType)
{
DereferenceEntity(token, (EntityType) propertyType, q);
}
else if (propertyType.IsCollectionType)
{
DereferenceCollection(token, ((CollectionType) propertyType).Role, q);
}
else if (token != null)
{
throw new QueryException("dereferenced: " + currentProperty);
}
}
}
}