当前位置: 首页>>代码示例>>C#>>正文


C# IASTNode类代码示例

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


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


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