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

C# IASTNode类代码示例

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

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



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

示例1: MakeIdent

 private static IASTNode MakeIdent(IASTNode source, string text)
 {
     var ident = source.DupNode();
     ident.Type = HqlSqlWalker.IDENT;
     ident.Text = text;
     return ident;
 }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:7,代码来源:PolymorphicQuerySourceDetector.cs


示例2: InsertChild

		/// <summary>
		/// Insert a new node into both the Tree and the Node Array. Add DOWN and UP nodes if needed.
		/// </summary>
		/// <param name="parent">The parent node</param>
		/// <param name="child">The child node</param>
		public void InsertChild(IASTNode parent, IASTNode child)
		{
			if (child.ChildCount > 0)
			{
				throw new InvalidOperationException("Currently do not support adding nodes with children");
			}

			int parentIndex = nodes.IndexOf(parent);
			int numberOfChildNodes = NumberOfChildNodes(parentIndex);
			int insertPoint;
			
			if (numberOfChildNodes == 0)
			{
				insertPoint = parentIndex + 1;  // We want to insert immediately after the parent
				nodes.Insert(insertPoint, down);
				insertPoint++;  // We've just added a new node
			}
			else
			{
				insertPoint = parentIndex + numberOfChildNodes;
			}

			parent.AddChild(child);
			nodes.Insert(insertPoint, child);
			insertPoint++;

			if (numberOfChildNodes == 0)
			{
				nodes.Insert(insertPoint, up);
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:36,代码来源:HqlSqlWalkerTreeNodeStream.cs


示例3: AddImpliedFromToFromNode

		private static void AddImpliedFromToFromNode(IASTNode fromClause, string collectionRole, ISessionFactoryImplementor factory)
		{
			SessionFactoryHelperExtensions _sessionFactoryHelper = new SessionFactoryHelperExtensions(factory);
			IQueryableCollection persister = _sessionFactoryHelper.GetCollectionPersister(collectionRole);
			IType collectionElementType = persister.ElementType;
			if (!collectionElementType.IsEntityType)
			{
				throw new QueryException("collection of values in filter: this");
			}

			string collectionElementEntityName = persister.ElementPersister.EntityName;

			ITreeAdaptor adaptor = new ASTTreeAdaptor();

			IASTNode fromElement = (IASTNode)adaptor.Create(HqlParser.FILTER_ENTITY, collectionElementEntityName);
			IASTNode alias = (IASTNode)adaptor.Create(HqlParser.ALIAS, "this");

			fromClause.AddChild(fromElement);
			fromClause.AddChild(alias);

			// Show the modified AST.
			if (log.IsDebugEnabled)
			{
				log.Debug("AddImpliedFormToFromNode() : Filter - Added 'this' as a from element...");
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:26,代码来源:HqlFilterPreprocessor.cs


示例4: Visit

		public void Visit(IASTNode node)
		{
			if (predicate == null || predicate(node))
			{
				collectedNodes.Add(node);
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:CollectingNodeVisitor.cs


示例5: Visit

 public void Visit(IASTNode node)
 {
     if (node.Type == HqlSqlWalker.FROM)
     {
         _nodes.AddRange(node.Where(child => child.Type == HqlSqlWalker.RANGE).Select(range => range.GetChild(0)));
     }
 }
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:QuerySourceDetector.cs


示例6: GenerateIdInsertSelect

		protected SqlString GenerateIdInsertSelect(IQueryable persister, string tableAlias, IASTNode whereClause)
		{
			var select = new SqlSelectBuilder(Factory);
			SelectFragment selectFragment = new SelectFragment(Factory.Dialect)
				.AddColumns(tableAlias, persister.IdentifierColumnNames, persister.IdentifierColumnNames);
			select.SetSelectClause(selectFragment.ToFragmentString().Substring(2));

			string rootTableName = persister.TableName;
			SqlString fromJoinFragment = persister.FromJoinFragment(tableAlias, true, false);
			SqlString whereJoinFragment = persister.WhereJoinFragment(tableAlias, true, false);

			select.SetFromClause(rootTableName + ' ' + tableAlias + fromJoinFragment);

			if (whereJoinFragment == null)
			{
				whereJoinFragment = SqlString.Empty;
			}
			else
			{
				whereJoinFragment = whereJoinFragment.Trim();
				if (whereJoinFragment.StartsWithCaseInsensitive("and "))
				{
					whereJoinFragment = whereJoinFragment.Substring(4);
				}
			}

			SqlString userWhereClause = SqlString.Empty;
			if (whereClause.ChildCount != 0)
			{
				// If a where clause was specified in the update/delete query, use it to limit the
				// returned ids here...
				try
				{
					var nodes = new CommonTreeNodeStream(whereClause);
					var gen = new SqlGenerator(Factory, nodes);
					gen.whereClause();
					userWhereClause = gen.GetSQL().Substring(7);
				}
				catch (RecognitionException e)
				{
					throw new HibernateException("Unable to generate id select for DML operation", e);
				}
				if (whereJoinFragment.Length > 0)
				{
					whereJoinFragment.Append(" and ");
				}
			}

			select.SetWhereClause(whereJoinFragment + userWhereClause);

			var insert = new InsertSelect();
			if (Factory.Settings.IsCommentsEnabled)
			{
				insert.SetComment("insert-select for " + persister.EntityName + " ids");
			}
			insert.SetTableName(persister.TemporaryIdTableName);
			insert.SetSelect(select);
			return insert.ToSqlString();
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:59,代码来源:AbstractStatementExecutor.cs


示例7: GetDebugstring

		/// <summary>
		/// Returns the 'list' representation with some brackets around it for debugging.
		/// </summary>
		/// <param name="n">The tree.</param>
		/// <returns>The list representation of the tree.</returns>
		public static string GetDebugstring(IASTNode n)
		{
			StringBuilder buf = new StringBuilder();
			buf.Append("[ ");
			buf.Append((n == null) ? "{null}" : n.ToStringTree());
			buf.Append(" ]");
			return buf.ToString();
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:13,代码来源:ASTUtil.cs


示例8: ReplaceBy

		public virtual void ReplaceBy(IASTNode node)
		{
			if (Parent != null)
			{
				throw new ApplicationException("Couldn't find a parent node to delegate");
			}

			Parent.ReplaceChild(this, node);
		}
开发者ID:ralescano,项目名称:castle,代码行数:9,代码来源:ASTNode.cs


示例9: AddImplementorsToMap

				private void AddImplementorsToMap(IASTNode querySource, string className, string[] implementors)
				{
					if (implementors.Length == 1 && implementors[0] == className)
					{
						// No need to change things
						return;
					}

					_map.Add(querySource,
					         implementors.Select(implementor => MakeIdent(querySource, implementor)).ToArray());
				}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:11,代码来源:PolymorphicQuerySourceDetector.cs


示例10: Process

				public Dictionary<IASTNode, IASTNode[]> Process(IASTNode tree)
				{
					foreach (var querySource in new QuerySourceDetector(tree).LocateQuerySources())
					{
						var className = GetClassName(querySource);
						string[] implementors = _sfi.GetImplementors(className);
						AddImplementorsToMap(querySource, className, implementors);
					}

					return _map;
				}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:11,代码来源:PolymorphicQuerySourceDetector.cs


示例11: TraverseDepthFirst

		/// <summary>
		/// Traverse the AST tree depth first. Note that the AST passed in is not visited itself.  Visitation starts
		/// with its children.
		/// </summary>
		/// <param name="ast">ast</param>
		public void TraverseDepthFirst(IASTNode ast)
		{
			if (ast == null)
			{
				throw new ArgumentNullException("ast");
			}

			for (int i = 0; i < ast.ChildCount; i++)
			{
				VisitDepthFirst(ast.GetChild(i));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:17,代码来源:NodeTraverser.cs


示例12: Process

        public Dictionary<IASTNode, IASTNode[]> Process(IASTNode tree)
        {
            foreach (var querySource in new QuerySourceDetector(tree).LocateQuerySources())
            {
                var className = GetClassName(querySource);
                var classType = _sessionFactoryHelper.GetImportedClass(className);

                AddImplementorsToMap(querySource, classType == null ? className : classType.FullName);
            }

            return _map;
        }
开发者ID:paulbatum,项目名称:nhibernate,代码行数:12,代码来源:PolymorphicQuerySourceDetector.cs


示例13: GetClassName

    	private static string GetClassName(IASTNode querySource)
        {
            switch (querySource.Type)
            {
                case HqlSqlWalker.IDENT:
                    return querySource.Text;
                case HqlSqlWalker.DOT:
                    return BuildPath(querySource);
            }

            // TODO
            throw new NotSupportedException();
        }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:13,代码来源:PolymorphicQuerySourceDetector.cs


示例14: QueryTranslatorImpl

		/// <summary>
		/// Creates a new AST-based query translator.
		/// </summary>
		/// <param name="queryIdentifier">The query-identifier (used in stats collection)</param>
        /// <param name="parsedQuery">The hql query to translate</param>
		/// <param name="enabledFilters">Currently enabled filters</param>
		/// <param name="factory">The session factory constructing this translator instance.</param>
		public QueryTranslatorImpl(
				string queryIdentifier,
				IASTNode parsedQuery,
				IDictionary<string, IFilter> enabledFilters,
				ISessionFactoryImplementor factory)
		{
			_queryIdentifier = queryIdentifier;
            _stageOneAst = parsedQuery;
			_compiled = false;
			_shallowQuery = false;
			_enabledFilters = enabledFilters;
			_factory = factory;
		}
开发者ID:paulbatum,项目名称:nhibernate,代码行数:20,代码来源:QueryTranslatorImpl.cs


示例15: DuplicateTree

        private IEnumerable<IASTNode> DuplicateTree()
        {
            var replacements = CrossJoinDictionaryArrays.PerformCrossJoin(_nodeMapping);

            var dups = new IASTNode[replacements.Count()];

            for (var i = 0; i < replacements.Count(); i++)
            {
                dups[i] = DuplicateTree(_ast, replacements[i]);
            }

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


示例16: AddImpliedFromToQuery

		/// <summary>
		/// Handles HQL AST transformation for collection filters (which are created with <see cref="ISession.CreateFilter"/>).
		/// 
		/// Adds FROM elements to implicit FROM clause.
		/// E.g., 
		/// <code>
		/// ( query ( SELECT_FROM {filter-implied FROM} ) ( where ( = X 10 ) ) )
		/// </code>
		/// gets converted to 
		/// <code>
		/// ( query ( SELECT_FROM ( FROM NHibernate.DomainModel.Many this ) ) ( where ( = X 10 ) ) )
		/// </code>
		/// </summary>
		/// <param name="ast">The root node of HQL query</param>
		/// <param name="collectionRole">Collection that is being filtered</param>
		/// <param name="factory">Session factory</param>
		internal static void AddImpliedFromToQuery(IASTNode ast, string collectionRole, ISessionFactoryImplementor factory)
		{
			if (ast.Type != HqlParser.QUERY)
			{
				var msg = string.Format(CultureInfo.InvariantCulture,
					"invalid query type for collection filtering: expected {0}, got {1}", HqlParser.tokenNames[HqlParser.QUERY], HqlParser.tokenNames[ast.Type]);
				throw new QueryException(msg);
			}
			var selectFromClause = ast.Where(x => x.Type == HqlParser.SELECT_FROM).Single();
			var fromClause = selectFromClause.Where(x => x.Type == HqlParser.FROM).Single();
			
			fromClause.Text = "FROM"; // Just for prettier debug output
			AddImpliedFromToFromNode(fromClause, collectionRole, factory);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:30,代码来源:HqlFilterPreprocessor.cs


示例17: VisitDepthFirst

		private void VisitDepthFirst(IASTNode ast)
		{
			if (ast == null)
			{
				return;
			}

			_visitor.Visit(ast);

			for (int i = 0; i < ast.ChildCount; i++)
			{
				VisitDepthFirst(ast.GetChild(i));
			}
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:14,代码来源:NodeTraverser.cs


示例18: BuildPath

        private static void BuildPath(IASTNode node, StringBuilder sb)
        {
            if (node.Type == HqlSqlWalker.DOT)
            {
                BuildPath(node.GetChild(0), sb);

                sb.Append('.');
                sb.Append(node.GetChild(1).Text);
            }
            else
            {
                sb.Append(node.Text);
            }
        }
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:14,代码来源:PolymorphicQuerySourceDetector.cs


示例19: RecursiveResolve

		public void RecursiveResolve(int level, bool impliedAtRoot, string classAlias, IASTNode parent)
		{
			IASTNode lhs = GetFirstChild();
			int nextLevel = level + 1;
			if ( lhs != null ) 
			{
				FromReferenceNode n = ( FromReferenceNode ) lhs;
				n.RecursiveResolve( nextLevel, impliedAtRoot, null, this );
			}

			ResolveFirstChild();
			bool impliedJoin = !(level == RootLevel && !impliedAtRoot);

			Resolve( true, impliedJoin, classAlias, parent );
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:15,代码来源:FromReferenceNode.cs


示例20: Check

		private static void Check(IASTNode check, IASTNode first, IASTNode second)
		{
			if (typeof(IExpectedTypeAwareNode).IsAssignableFrom(check.GetType()))
			{
				IType expectedType = null;
				if (typeof(SqlNode).IsAssignableFrom(first.GetType()))
				{
					expectedType = ((SqlNode)first).DataType;
				}
				if (expectedType == null && typeof(SqlNode).IsAssignableFrom(second.GetType()))
				{
					expectedType = ((SqlNode)second).DataType;
				}
				((IExpectedTypeAwareNode)check).ExpectedType = expectedType;
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:16,代码来源:BetweenOperatorNode.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IASTVisitor类代码示例发布时间:2022-05-24
下一篇:
C# IASTFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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