本文整理汇总了C#中NHibernate.Hql.Classic.QueryTranslator.AddType方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTranslator.AddType方法的具体用法?C# QueryTranslator.AddType怎么用?C# QueryTranslator.AddType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Hql.Classic.QueryTranslator
的用法示例。
在下文中一共展示了QueryTranslator.AddType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContinueFromManyToMany
public string ContinueFromManyToMany(string clazz, string[] joinColumns, QueryTranslator q)
{
Start(q);
continuation = true;
currentName = q.CreateNameFor(clazz);
q.AddType(currentName, clazz);
IQueryable classPersister = q.GetPersister(clazz);
AddJoin(currentName, TypeFactory.ManyToOne(clazz), joinColumns);
currentPropertyMapping = classPersister;
return currentName;
}
示例2: DereferenceEntity
/// <summary>
///
/// </summary>
/// <param name="propertyName"></param>
/// <param name="propertyType"></param>
/// <param name="q"></param>
/// <remarks>NOTE: we avoid joining to the next table if the named property is just the foreign key value</remarks>
private void DereferenceEntity(string propertyName, EntityType propertyType, QueryTranslator q)
{
//if its "id"
bool isIdShortcut = EntityID.Equals(propertyName) && !propertyType.IsUniqueKeyReference;
//or its the id property name
string idPropertyName;
try
{
idPropertyName = propertyType.GetIdentifierOrUniqueKeyPropertyName(q.Factory);
}
catch (MappingException me)
{
throw new QueryException(me);
}
bool isNamedIdPropertyShortcut = idPropertyName != null && idPropertyName.Equals(propertyName);
if (isIdShortcut || isNamedIdPropertyShortcut)
{
// special shortcut for id properties, skip the join!
// this must only occur at the _end_ of a path expression
DereferenceProperty(propertyName);
}
else
{
string entityClass = propertyType.GetAssociatedEntityName();
string name = q.CreateNameFor(entityClass);
q.AddType(name, entityClass);
//String[] keyColNames = memberPersister.getIdentifierColumnNames();
AddJoin(name, propertyType);
if (propertyType.IsOneToOne)
{
oneToOneOwnerName = currentName;
}
else
{
oneToOneOwnerName = null;
}
ownerAssociationType = propertyType;
currentName = name;
currentProperty = propertyName;
q.AddPathAliasAndJoin(path.ToString(0, path.ToString().LastIndexOf(StringHelper.Dot)), name, joinSequence.Copy());
componentPath.Length = 0;
currentPropertyMapping = q.GetPersister(entityClass);
}
}