本文整理汇总了C#中NHibernate.Engine.JoinSequence类的典型用法代码示例。如果您正苦于以下问题:C# JoinSequence类的具体用法?C# JoinSequence怎么用?C# JoinSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JoinSequence类属于NHibernate.Engine命名空间,在下文中一共展示了JoinSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCollectionSubquery
public static string CreateCollectionSubquery(
JoinSequence joinSequence,
IDictionary enabledFilters,
String[] columns)
{
try
{
JoinFragment join = joinSequence.ToJoinFragment(enabledFilters, true);
return new StringBuilder()
.Append("select ")
.Append(StringHelper.Join(", ", columns))
.Append(" from ")
.Append(join.ToFromFragmentString.Substring(2)) // remove initial ", "
.Append(" where ")
.Append(join.ToWhereFragmentString.Substring(5)) // remove initial " and "
.ToString();
}
catch (MappingException me)
{
throw new QueryException(me);
}
}
示例2: AddFrom
internal void AddFrom(string name, string type, JoinSequence joinSequence)
{
AddType(name, type);
AddFrom(name, joinSequence);
}
示例3: AddFromJoinOnly
public void AddFromJoinOnly(string name, JoinSequence joinSequence)
{
AddJoin(name, joinSequence.GetFromPart());
}
示例4: AddPathAliasAndJoin
internal void AddPathAliasAndJoin(string path, string alias, JoinSequence joinSequence)
{
pathAliases.Add(path, alias);
pathJoins.Add(path, joinSequence);
}
示例5: 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);
}
示例6: CreateCollectionJoin
private FromElement CreateCollectionJoin(JoinSequence collectionJoinSequence, string tableAlias)
{
string text = _queryableCollection.TableName;
IASTNode ast = CreateFromElement(text);
FromElement destination = (FromElement)ast;
IType elementType = _queryableCollection.ElementType;
if (elementType.IsCollectionType)
{
throw new SemanticException("Collections of collections are not supported!");
}
destination.InitializeCollection(_fromClause, _classAlias, tableAlias);
destination.Type = HqlSqlWalker.JOIN_FRAGMENT; // Tag this node as a JOIN.
destination.SetIncludeSubclasses(false); // Don't include subclasses in the join.
destination.CollectionJoin = true; // This is a clollection join.
destination.JoinSequence = collectionJoinSequence;
destination.SetOrigin(_origin, false);
destination.CollectionTableAlias = tableAlias;
// origin.addDestination( destination );
// This was the cause of HHH-242
// origin.setType( FROM_FRAGMENT ); // Set the parent node type so that the AST is properly formed.
_origin.Text = ""; // The destination node will have all the FROM text.
_origin.CollectionJoin = true; // The parent node is a collection join too (voodoo - see JoinProcessor)
_fromClause.AddCollectionJoinFromElementByPath(_path, destination);
_fromClause.Walker.AddQuerySpaces(_queryableCollection.CollectionSpaces);
return destination;
}
示例7: Start
/// <summary>
///
/// </summary>
/// <param name="q"></param>
public void Start(QueryTranslator q)
{
if (!continuation)
{
Reset(q);
path.Length = 0;
joinSequence = new JoinSequence(q.Factory).SetUseThetaStyle(useThetaStyleJoin);
}
}
示例8: AddFromClass
internal void AddFromClass(string name, IQueryable classPersister)
{
JoinSequence joinSequence = new JoinSequence(Factory)
.SetRoot(classPersister, name);
AddFrom(name, classPersister.EntityName, joinSequence);
}
示例9: SetNext
public JoinSequence SetNext(JoinSequence next)
{
this.next = next;
return this;
}
示例10: GetFromPart
public JoinSequence GetFromPart()
{
JoinSequence fromPart = new JoinSequence(factory);
fromPart.joins.AddRange(this.joins);
fromPart.useThetaStyle = this.useThetaStyle;
fromPart.rootAlias = this.rootAlias;
fromPart.rootJoinable = this.rootJoinable;
fromPart.selector = this.selector;
fromPart.next = this.next == null ? null : this.next.GetFromPart();
fromPart.isFromPart = true;
return fromPart;
}
示例11: Copy
public JoinSequence Copy()
{
JoinSequence copy = new JoinSequence(factory);
copy.joins.AddRange(this.joins);
copy.useThetaStyle = this.useThetaStyle;
copy.rootAlias = this.rootAlias;
copy.rootJoinable = this.rootJoinable;
copy.selector = this.selector;
copy.next = this.next == null ? null : this.next.Copy();
copy.isFromPart = this.isFromPart;
copy.conditions.Add(this.conditions.ToSqlString());
return copy;
}
示例12: InitializeJoin
private FromElement InitializeJoin(
string path,
FromElement destination,
JoinSequence joinSequence,
string[] columns,
FromElement origin,
bool manyToMany)
{
destination.Type = HqlSqlWalker.JOIN_FRAGMENT;
destination.JoinSequence = joinSequence;
destination.Columns = columns;
destination.SetOrigin(origin, manyToMany);
_fromClause.AddJoinByPathMap(path, destination);
return destination;
}
示例13: CreateJoin
private FromElement CreateJoin(
string entityClass,
string tableAlias,
JoinSequence joinSequence,
EntityType type,
bool manyToMany)
{
// origin, path, implied, columns, classAlias,
IEntityPersister entityPersister = _fromClause.SessionFactoryHelper.RequireClassPersister(entityClass);
FromElement destination = CreateAndAddFromElement(entityClass,
_classAlias,
entityPersister,
type,
tableAlias);
return InitializeJoin(_path, destination, joinSequence, Columns, _origin, manyToMany);
}
示例14: AddFromCollection
internal void AddFromCollection(string name, string collectionRole, JoinSequence joinSequence)
{
//register collection role
AddCollection(name, collectionRole);
AddJoin(name, joinSequence);
}
示例15: AddJoinNodes
private void AddJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement)
{
JoinFragment joinFragment = join.ToJoinFragment(
_walker.EnabledFilters,
fromElement.UseFromFragment || fromElement.IsDereferencedBySuperclassOrSubclassProperty,
fromElement.WithClauseFragment,
fromElement.WithClauseJoinAlias
);
SqlString frag = joinFragment.ToFromFragmentString;
SqlString whereFrag = joinFragment.ToWhereFragmentString;
// If the from element represents a JOIN_FRAGMENT and it is
// a theta-style join, convert its type from JOIN_FRAGMENT
// to FROM_FRAGMENT
if ( fromElement.Type == HqlSqlWalker.JOIN_FRAGMENT &&
( join.IsThetaStyle || SqlStringHelper.IsNotEmpty( whereFrag ) ) )
{
fromElement.Type = HqlSqlWalker.FROM_FRAGMENT;
fromElement.JoinSequence.SetUseThetaStyle( true ); // this is used during SqlGenerator processing
}
// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
if ( fromElement.UseFromFragment /*&& StringHelper.isNotEmpty( frag )*/ )
{
SqlString fromFragment = ProcessFromFragment( frag, join ).Trim();
if ( log.IsDebugEnabled )
{
log.Debug( "Using FROM fragment [" + fromFragment + "]" );
}
ProcessDynamicFilterParameters(fromFragment,fromElement,_walker);
}
_syntheticAndFactory.AddWhereFragment(
joinFragment,
whereFrag,
query,
fromElement,
_walker
);
}