本文整理汇总了C#中NHibernate.Engine.JoinSequence类的典型用法代码示例。如果您正苦于以下问题:C# JoinSequence类的具体用法?C# JoinSequence怎么用?C# JoinSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JoinSequence类属于NHibernate.Engine命名空间,在下文中一共展示了JoinSequence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:22,代码来源:CollectionSubqueryFactory.cs
示例2: AddFrom
internal void AddFrom(string name, string type, JoinSequence joinSequence)
{
AddType(name, type);
AddFrom(name, joinSequence);
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:5,代码来源:QueryTranslator.cs
示例3: AddFromJoinOnly
public void AddFromJoinOnly(string name, JoinSequence joinSequence)
{
AddJoin(name, joinSequence.GetFromPart());
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:4,代码来源:QueryTranslator.cs
示例4: AddPathAliasAndJoin
internal void AddPathAliasAndJoin(string path, string alias, JoinSequence joinSequence)
{
pathAliases.Add(path, alias);
pathJoins.Add(path, joinSequence);
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:5,代码来源:QueryTranslator.cs
示例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);
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:40,代码来源:QueryTranslator.cs
示例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;
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:28,代码来源:FromElementFactory.cs
示例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);
}
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:13,代码来源:PathExpressionParser.cs
示例8: AddFromClass
internal void AddFromClass(string name, IQueryable classPersister)
{
JoinSequence joinSequence = new JoinSequence(Factory)
.SetRoot(classPersister, name);
AddFrom(name, classPersister.EntityName, joinSequence);
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:6,代码来源:QueryTranslator.cs
示例9: SetNext
public JoinSequence SetNext(JoinSequence next)
{
this.next = next;
return this;
}
开发者ID:pallmall,项目名称:WCell,代码行数:5,代码来源:JoinSequence.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:12,代码来源:JoinSequence.cs
示例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;
}
开发者ID:pallmall,项目名称:WCell,代码行数:13,代码来源:JoinSequence.cs
示例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;
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:15,代码来源:FromElementFactory.cs
示例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);
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:16,代码来源:FromElementFactory.cs
示例14: AddFromCollection
internal void AddFromCollection(string name, string collectionRole, JoinSequence joinSequence)
{
//register collection role
AddCollection(name, collectionRole);
AddJoin(name, joinSequence);
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:6,代码来源:QueryTranslator.cs
示例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
);
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:42,代码来源:JoinProcessor.cs
示例16: ProcessFromFragment
private static SqlString ProcessFromFragment(SqlString frag, JoinSequence join)
{
SqlString fromFragment = frag.Trim();
// The FROM fragment will probably begin with ', '. Remove this if it is present.
if ( fromFragment.StartsWithCaseInsensitive( ", " ) ) {
fromFragment = fromFragment.Substring( 2 );
}
return fromFragment;
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:9,代码来源:JoinProcessor.cs
示例17: AddJoin
internal void AddJoin(string name, JoinSequence joinSequence)
{
if (!joins.ContainsKey(name))
{
joins.Add(name, joinSequence);
}
}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:7,代码来源:QueryTranslator.cs
示例18: AddJoin
private void AddJoin(JoinSequence joinSequence, QueryTranslator q)
{
q.AddFromJoinOnly(pathExpressionParser.Name, joinSequence);
try
{
AddToCurrentJoin(joinSequence.ToJoinFragment(q.EnabledFilters, true).ToWhereFragmentString);
}
catch (MappingException me)
{
throw new QueryException(me);
}
}
开发者ID:nikson,项目名称:nhibernate-core,代码行数:12,代码来源:WhereParser.cs
示例19: PrepareForIndex
private void PrepareForIndex(QueryTranslator q)
{
IQueryableCollection collPersister = q.GetCollectionPersister(collectionRole);
if (!collPersister.HasIndex)
{
throw new QueryException("unindexed collection before []");
}
string[] indexCols = collPersister.IndexColumnNames;
if (indexCols.Length != 1)
{
throw new QueryException("composite-index appears in []: " + path);
}
JoinSequence fromJoins = new JoinSequence(q.Factory)
.SetUseThetaStyle(useThetaStyleJoin)
.SetRoot(collPersister, collectionName)
.SetNext(joinSequence.Copy());
if (!continuation)
{
AddJoin(collectionName, collPersister.CollectionType);
}
joinSequence.AddCondition(new SqlString(collectionName + '.' + indexCols[0] + " = "));
CollectionElement elem = new CollectionElement();
elem.ElementColumns = collPersister.GetElementColumnNames(collectionName);
elem.Type = collPersister.ElementType;
elem.IsOneToMany = collPersister.IsOneToMany;
elem.Alias = collectionName;
elem.JoinSequence = joinSequence;
collectionElements.Add(elem); //addlast
SetExpectingCollectionIndex();
q.AddCollection(collectionName, collectionRole);
q.AddJoin(collectionName, fromJoins);
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:37,代码来源:PathExpressionParser.cs
示例20: CreateEntityJoin
public FromElement CreateEntityJoin(
string entityClass,
string tableAlias,
JoinSequence joinSequence,
bool fetchFlag,
bool inFrom,
EntityType type)
{
FromElement elem = CreateJoin(entityClass, tableAlias, joinSequence, type, false);
elem.Fetch = fetchFlag;
//if (numberOfTables > 1 && _implied && !elem.UseFromFragment)
// NH Different behavior: numberOfTables was removed because an
// implicit join is an implicit join even if it not come from a
// multi-table entity
if (_implied && !elem.UseFromFragment)
{
if (Log.IsDebugEnabled)
{
Log.Debug("createEntityJoin() : Implied entity join");
}
elem.UseFromFragment = true;
}
// If this is an implied join in a FROM clause, then use ANSI-style joining, and set the
// flag on the FromElement that indicates that it was implied in the FROM clause itself.
if (_implied && inFrom)
{
joinSequence.SetUseThetaStyle(false);
elem.UseFromFragment = true;
elem.SetImpliedInFromClause(true);
}
if (elem.Walker.IsSubQuery)
{
// two conditions where we need to transform this to a theta-join syntax:
// 1) 'elem' is the "root from-element" in correlated subqueries
// 2) The DotNode.useThetaStyleImplicitJoins has been set to true
// and 'elem' represents an implicit join
if (elem.FromClause != elem.Origin.FromClause || DotNode.UseThetaStyleImplicitJoins)
{
// the "root from-element" in correlated subqueries do need this piece
elem.Type = HqlSqlWalker.FROM_FRAGMENT;
joinSequence.SetUseThetaStyle(true);
elem.UseFromFragment = false;
}
}
return elem;
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:49,代码来源:FromElementFactory.cs
注:本文中的NHibernate.Engine.JoinSequence类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论