• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Tree.FromElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NHibernate.Hql.Ast.ANTLR.Tree.FromElement的典型用法代码示例。如果您正苦于以下问题:C# FromElement类的具体用法?C# FromElement怎么用?C# FromElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FromElement类属于NHibernate.Hql.Ast.ANTLR.Tree命名空间,在下文中一共展示了FromElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FromElementFactory

		/// <summary>
		/// Creates entity from elements.
		/// </summary>
		/// <param name="fromClause"></param>
		/// <param name="origin"></param>
		/// <param name="path"></param>
		public FromElementFactory(FromClause fromClause, FromElement origin, string path)
		{
			_fromClause = fromClause;
			_origin = origin;
			_path = path;
			_collection = false;
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:13,代码来源:FromElementFactory.cs


示例2: FromElement

		/// <summary>
		/// Constructor form used to initialize <see cref="ComponentJoin"/>.
		/// </summary>
		/// <param name="fromClause">The FROM clause to which this element belongs.</param>
		/// <param name="origin">The origin (LHS) of this element.</param>
		/// <param name="alias">The alias applied to this element.</param>
		protected FromElement(FromClause fromClause,FromElement origin,string alias):this(origin._token)
		{
			_fromClause = fromClause;
			_origin = origin;
			_classAlias = alias;
			_tableAlias = origin.TableAlias;
			base.Initialize(fromClause.Walker);
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:14,代码来源:FromElement.cs


示例3: FromElementType

		public FromElementType(FromElement fromElement, IEntityPersister persister, EntityType entityType)
		{
			_fromElement = fromElement;
			_persister = persister;
			_entityType = entityType;

			var queryable = persister as IQueryable;
			if (queryable != null)
				fromElement.Text = queryable.TableName + " " + fromElement.TableAlias;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:10,代码来源:FromElementType.cs


示例4: FromElementType

		public FromElementType(FromElement fromElement, IEntityPersister persister, EntityType entityType)
		{
			_fromElement = fromElement;
			_persister = persister;
			_entityType = entityType;

			if (persister != null)
			{
				fromElement.Text = ((IQueryable)persister).TableName + " " + TableAlias;
			}
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:11,代码来源:FromElementType.cs


示例5: ComponentJoin

		public ComponentJoin(FromClause fromClause, FromElement origin, string alias, string componentPath, ComponentType componentType)
			: base(fromClause, origin, alias)
		{
			this.componentPath = componentPath;
			this.componentType = componentType;
			componentProperty = StringHelper.Unqualify(componentPath);
			fromClause.AddJoinByPathMap(componentPath, this);
			InitializeComponentJoin(new ComponentFromElementType(this));

			string[] cols = origin.GetPropertyMapping("").ToColumns(TableAlias, componentProperty);
			columns = string.Join(", ", cols);
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:12,代码来源:ComponentJoin.cs


示例6: RenderNonScalarIdentifiers

		private void RenderNonScalarIdentifiers(FromElement fromElement, int nonscalarSize, int j, ISelectExpression expr, ASTAppender appender)
		{
			string text = fromElement.RenderIdentifierSelect(nonscalarSize, j);

			if (!fromElement.FromClause.IsSubQuery)
			{
				if (!_scalarSelect && !Walker.IsShallowQuery)
				{
					//TODO: is this a bit ugly?
					expr.Text = text;
				}
				else
				{
					appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
				}
			}
		}
开发者ID:ntuveri,项目名称:nhibernate-core,代码行数:17,代码来源:SelectClause.cs


示例7: GenerateSyntheticDotNodeForNonQualifiedPropertyRef

		IASTNode GenerateSyntheticDotNodeForNonQualifiedPropertyRef(IASTNode property, FromElement fromElement)
		{
			IASTNode dot = (IASTNode) adaptor.Create(DOT, "{non-qualified-property-ref}");

			// TODO : better way?!?
			((DotNode)dot).PropertyPath = ((FromReferenceNode)property).Path;

			IdentNode syntheticAlias = (IdentNode)adaptor.Create(IDENT, "{synthetic-alias}");
			syntheticAlias.FromElement = fromElement;
			syntheticAlias.IsResolved = true;

			dot.SetFirstChild(syntheticAlias);
			dot.AddChild(property);

			return dot;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:16,代码来源:HqlSqlWalker.cs


示例8: Visit

		public void Visit(IASTNode node) 
		{
			// todo : currently expects that the individual with expressions apply to the same sql table join.
			//      This may not be the case for joined-subclass where the property values
			//      might be coming from different tables in the joined hierarchy.  At some
			//      point we should expand this to support that capability.  However, that has
			//      some difficulties:
			//          1) the biggest is how to handle ORs when the individual comparisons are
			//              linked to different sql joins.
			//          2) here we would need to track each comparison individually, along with
			//              the join alias to which it applies and then pass that information
			//              back to the FromElement so it can pass it along to the JoinSequence
			if ( node is DotNode ) 
			{
				DotNode dotNode = ( DotNode ) node;
				FromElement fromElement = dotNode.FromElement;
				if ( _referencedFromElement != null )
				{
					if ( fromElement != _referencedFromElement ) 
					{
						throw new HibernateException( "with-clause referenced two different from-clause elements" );
					}
				}
				else
				{
					_referencedFromElement = fromElement;
					_joinAlias = ExtractAppliedAlias( dotNode );

					// todo : temporary
					//      needed because currently persister is the one that
					//      creates and renders the join fragments for inheritence
					//      hierarchies...
					if ( _joinAlias != _referencedFromElement.TableAlias) 
					{
						throw new InvalidWithClauseException( "with clause can only reference columns in the driving table" );
					}
				}
			}
			else if ( node is ParameterNode ) 
			{
				ApplyParameterSpecification(((ParameterNode) node).HqlParameterSpecification);
			}
			else if ( node is IParameterContainer ) 
			{
				ApplyParameterSpecifications( ( IParameterContainer ) node );
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:47,代码来源:HqlSqlWalker.cs


示例9: WithClauseVisitor

		public WithClauseVisitor(FromElement fromElement) 
		{
			_joinFragment = fromElement;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:4,代码来源:HqlSqlWalker.cs


示例10: ResolveCollectionProperty

		public void ResolveCollectionProperty(IASTNode expr)
		{
			String propertyName = CollectionProperties.GetNormalizedPropertyName( _methodName );

			if ( expr is FromReferenceNode ) 
			{
				FromReferenceNode collectionNode = ( FromReferenceNode ) expr;
				// If this is 'elements' then create a new FROM element.
				if ( CollectionPropertyNames.Elements == propertyName ) 
				{
					HandleElements( collectionNode, propertyName );
				}
				else {
					// Not elements(x)
					_fromElement = collectionNode.FromElement;
					DataType = _fromElement.GetPropertyType( propertyName, propertyName );
					_selectColumns = _fromElement.ToColumns( _fromElement.TableAlias, propertyName, _inSelect );
				}
				if ( collectionNode is DotNode ) 
				{
					PrepareAnyImplicitJoins( ( DotNode ) collectionNode );
				}
				if ( !_inSelect ) 
				{
					_fromElement.Text = "";
					_fromElement.UseWhereFragment = false;
				}

				PrepareSelectColumns( _selectColumns );
				Text = _selectColumns[0];
				Type = HqlSqlWalker.SQL_TOKEN;
			}
			else 
			{
				throw new SemanticException( 
						"Unexpected expression " + expr + 
						" found for collection function " + propertyName 
					);
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:40,代码来源:MethodNode.cs


示例11: AddDuplicateAlias

		public void AddDuplicateAlias(string alias, FromElement element)
		{
			if (alias != null)
			{
				_fromElementByClassAlias.Add(alias, element);
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:FromClause.cs


示例12: AddJoinByPathMap

		public void AddJoinByPathMap(string path, FromElement destination)
		{
			if (Log.IsDebugEnabled)
			{
				Log.Debug("addJoinByPathMap() : " + path + " -> " + destination);
			}

			_fromElementsByPath.Add(path, destination);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:9,代码来源:FromClause.cs


示例13: SetOrigin

		public void SetOrigin(FromElement origin, bool manyToMany)
		{
			_origin = origin;
			origin.AddDestination(this);

			if (origin.FromClause == FromClause)
			{
				// TODO: Figure out a better way to get the FROM elements in a proper tree structure.
				// If this is not the destination of a many-to-many, add it as a child of the origin.
				if (manyToMany)
				{
					origin.AddSibling(this);
				}
				else
				{
					if (!Walker.IsInFrom && !Walker.IsInSelect)
					{
						FromClause.AddChild(this);
					}
					else
					{
						origin.AddChild(this);
					}
				}
			}
			else if (!Walker.IsInFrom)
			{
				// HHH-276 : implied joins in a subselect where clause - The destination needs to be added
				// to the destination's from clause.
				FromClause.AddChild(this);	// Not sure if this is will fix everything, but it works.
			}
			else
			{
				// Otherwise, the destination node was implied by the FROM clause and the FROM clause processor
				// will automatically add it in the right place.
			}
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:37,代码来源:FromElement.cs


示例14: GetOrigin

		private static FromElement GetOrigin(FromElement fromElement)
		{
			var realOrigin = fromElement.RealOrigin;
			if (realOrigin != null)
				return realOrigin;

			// work around that crazy issue where the tree contains
			// "empty" FromElements (no text); afaict, this is caused
			// by FromElementFactory.createCollectionJoin()
			var origin = fromElement.Origin;
			if (origin == null)
				throw new QueryException("Unable to determine origin of join fetch [" + fromElement.GetDisplayText() + "]");

			return origin;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:15,代码来源:SelectClause.cs


示例15: RenderNonScalarProperties

		private static void RenderNonScalarProperties(ASTAppender appender, FromElement fromElement, int nonscalarSize, int k)
		{
			string text = fromElement.RenderPropertySelect(nonscalarSize, k);
			appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);

			if (fromElement.QueryableCollection != null && fromElement.IsFetch)
			{
				text = fromElement.RenderCollectionSelectFragment(nonscalarSize, k);
				appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
			}

			// Look through the FromElement's children to find any collections of values that should be fetched...
			ASTIterator iter = new ASTIterator(fromElement);
			foreach (FromElement child in iter)
			{
				if (child.IsCollectionOfValuesOrComponents && child.IsFetch)
				{
					// Need a better way to define the suffixes here...
					text = child.RenderValueCollectionSelectFragment(nonscalarSize, nonscalarSize + k);
					appender.Append(HqlSqlWalker.SQL_TOKEN, text, false);
				}
			}
		}
开发者ID:ntuveri,项目名称:nhibernate-core,代码行数:23,代码来源:SelectClause.cs


示例16: SetImpliedJoin

		private void SetImpliedJoin(FromElement elem)
		{
			_impliedJoin = elem;
			if (GetFirstChild().Type == HqlSqlWalker.DOT)
			{
				DotNode dotLhs = (DotNode)GetFirstChild();
				if (dotLhs.GetImpliedJoin() != null)
				{
					_impliedJoin = dotLhs.GetImpliedJoin();
				}
			}
		}
开发者ID:juanplopes,项目名称:nhibernate,代码行数:12,代码来源:DotNode.cs


示例17: CreateFromElementInSubselect

		private FromElement CreateFromElementInSubselect(
				string path,
				string pathAlias,
				FromElement parentFromElement,
				string classAlias)
		{
			if (Log.IsDebugEnabled)
			{
				Log.Debug("createFromElementInSubselect() : path = " + path);
			}

			// Create an DotNode AST for the path and resolve it.
			FromElement fromElement = EvaluateFromElementPath(path, classAlias);
			IEntityPersister entityPersister = fromElement.EntityPersister;

			// If the first identifier in the path referrs to the class alias (not the class name), then this
			// is a correlated subselect.  If it's a correlated sub-select, use the existing table alias.  Otherwise
			// generate a new one.
			bool correlatedSubselect = pathAlias == parentFromElement.ClassAlias;
			
			string tableAlias = correlatedSubselect ? fromElement.TableAlias : null;

			// If the from element isn't in the same clause, create a new from element.
			if (fromElement.FromClause != _fromClause)
			{
				if (Log.IsDebugEnabled)
				{
					Log.Debug("createFromElementInSubselect() : creating a new FROM element...");
				}

				fromElement = CreateFromElement(entityPersister);

				InitializeAndAddFromElement(fromElement,
								path,
								classAlias,
								entityPersister,
								(EntityType)((IQueryable)entityPersister).Type,
								tableAlias
				);
			}
			if (Log.IsDebugEnabled)
			{
				Log.Debug("createFromElementInSubselect() : " + path + " -> " + fromElement);
			}

			return fromElement;
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:47,代码来源:FromElementFactory.cs


示例18: InitializeAndAddFromElement

		private void InitializeAndAddFromElement(FromElement element,
																						string className,
																						string classAlias,
																						IEntityPersister entityPersister,
																						EntityType type,
																						string tableAlias)
		{
			if (tableAlias == null)
			{
				AliasGenerator aliasGenerator = _fromClause.AliasGenerator;
				tableAlias = aliasGenerator.CreateName(entityPersister.EntityName);
			}
			element.InitializeEntity(_fromClause, className, entityPersister, type, classAlias, tableAlias);
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:14,代码来源:FromElementFactory.cs


示例19: 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


示例20: AddCollectionFromElement

		private void AddCollectionFromElement(FromElement fromElement)
		{
			if (fromElement.IsFetch)
			{
				if (fromElement.CollectionJoin || fromElement.QueryableCollection != null)
				{
					String suffix;
					if (_collectionFromElements == null)
					{
						_collectionFromElements = new List<FromElement>();
						suffix = VERSION2_SQL ? "__" : "0__";
					}
					else
					{
						suffix = _collectionFromElements.Count + "__";
					}
					_collectionFromElements.Add(fromElement);
					fromElement.CollectionSuffix = suffix;
				}
			}
		}
开发者ID:ntuveri,项目名称:nhibernate-core,代码行数:21,代码来源:SelectClause.cs



注:本文中的NHibernate.Hql.Ast.ANTLR.Tree.FromElement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Classic.QueryTranslator类代码示例发布时间:2022-05-26
下一篇:
C# Ast.HqlTreeNode类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap