本文整理汇总了C#中NHibernate.Engine.JoinSequence.AddCondition方法的典型用法代码示例。如果您正苦于以下问题:C# JoinSequence.AddCondition方法的具体用法?C# JoinSequence.AddCondition怎么用?C# JoinSequence.AddCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Engine.JoinSequence
的用法示例。
在下文中一共展示了JoinSequence.AddCondition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFromAssociation
/// <remarks>Used for collection filters</remarks>
protected void AddFromAssociation(string elementName, string collectionRole)
{
//q.addCollection(collectionName, collectionRole);
IType collectionElementType = GetCollectionPersister(collectionRole).ElementType;
if (!collectionElementType.IsEntityType)
{
throw new QueryException("collection of values in filter: " + elementName);
}
IQueryableCollection persister = GetCollectionPersister(collectionRole);
string[] keyColumnNames = persister.KeyColumnNames;
//if (keyColumnNames.Length!=1) throw new QueryException("composite-key collecion in filter: " + collectionRole);
string collectionName;
JoinSequence join = new JoinSequence(Factory);
collectionName = persister.IsOneToMany ? elementName : CreateNameForCollection(collectionRole);
join.SetRoot(persister, collectionName);
if (!persister.IsOneToMany)
{
//many-to-many
AddCollection(collectionName, collectionRole);
try
{
join.AddJoin(
(IAssociationType) persister.ElementType,
elementName,
JoinType.InnerJoin,
persister.GetElementColumnNames(collectionName));
}
catch (MappingException me)
{
throw new QueryException(me);
}
}
join.AddCondition(collectionName, keyColumnNames, " = ", true);
EntityType elmType = (EntityType) collectionElementType;
AddFrom(elementName, elmType.GetAssociatedEntityName(), join);
}