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


C# QueryFromClause类代码示例

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


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

示例1: VisitQueryFromClause

 public override void VisitQueryFromClause(QueryFromClause queryFromClause)
 {
     base.VisitQueryFromClause(queryFromClause);
     indexData.FromExpression = queryFromClause.Expression.Clone();
     indexData.FromIdentifier = queryFromClause.Identifier;
     indexData.NumberOfFromClauses++;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:7,代码来源:IndexVisitor.cs

示例2: TryRemoveTransparentIdentifier

		bool TryRemoveTransparentIdentifier(QueryExpression query, QueryFromClause fromClause, QueryExpression innerQuery)
		{
			if (!IsTransparentIdentifier(fromClause.Identifier))
				return false;
			Match match = selectTransparentIdentifierPattern.Match(innerQuery.Clauses.Last());
			if (!match.Success)
				return false;
			QuerySelectClause selectClause = (QuerySelectClause)innerQuery.Clauses.Last();
			NamedArgumentExpression nae1 = match.Get<NamedArgumentExpression>("nae1").Single();
			NamedArgumentExpression nae2 = match.Get<NamedArgumentExpression>("nae2").Single();
			if (nae1.Identifier != ((IdentifierExpression)nae1.Expression).Identifier)
				return false;
			IdentifierExpression nae2IdentExpr = nae2.Expression as IdentifierExpression;
			if (nae2IdentExpr != null && nae2.Identifier == nae2IdentExpr.Identifier) {
				// from * in (from x in ... select new { x = x, y = y }) ...
				// =>
				// from x in ... ...
				fromClause.Remove();
				selectClause.Remove();
				// Move clauses from innerQuery to query
				QueryClause insertionPos = null;
				foreach (var clause in innerQuery.Clauses) {
					query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
				}
			} else {
				// from * in (from x in ... select new { x = x, y = expr }) ...
				// =>
				// from x in ... let y = expr ...
				fromClause.Remove();
				selectClause.Remove();
				// Move clauses from innerQuery to query
				QueryClause insertionPos = null;
				foreach (var clause in innerQuery.Clauses) {
					query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
				}
				query.Clauses.InsertAfter(insertionPos, new QueryLetClause { Identifier = nae2.Identifier, Expression = nae2.Expression.Detach() });
			}
			return true;
		}
开发者ID:tris2481,项目名称:ILSpy,代码行数:39,代码来源:CombineQueryExpressions.cs

示例3: Visit

			public override object Visit(Mono.CSharp.Linq.SelectMany selectMany)
			{
				var fromClause = new QueryFromClause();

				fromClause.AddChild(new CSharpTokenNode(Convert(selectMany.Location), QueryFromClause.FromKeywordRole), QueryFromClause.FromKeywordRole);
				
				if (selectMany.IdentifierType != null)
					fromClause.AddChild(ConvertToType(selectMany.IdentifierType), Roles.Type);
				
				fromClause.AddChild(Identifier.Create(selectMany.IntoVariable.Name, Convert(selectMany.IntoVariable.Location)), Roles.Identifier);
				
				var location = LocationsBag.GetLocations(selectMany);
				if (location != null)
					fromClause.AddChild(new CSharpTokenNode(Convert(location [0]), QueryFromClause.InKeywordRole), QueryFromClause.InKeywordRole);

				if (selectMany.Expr != null)
					fromClause.AddChild((Expression)selectMany.Expr.Accept(this), Roles.Expression);
				return fromClause;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:19,代码来源:CSharpParser.cs

示例4: TryRemoveTransparentIdentifier

		bool TryRemoveTransparentIdentifier(QueryExpression query, QueryFromClause fromClause, QueryExpression innerQuery, string continuationIdentifier, out string transparentIdentifier)
		{
			transparentIdentifier = fromClause.Identifier;

			Match match = selectTransparentIdentifierPattern.Match(innerQuery.Clauses.Last());
			if (!match.Success)
				return false;
			QuerySelectClause selectClause = (QuerySelectClause)innerQuery.Clauses.Last();
			Expression nae1 = match.Get<Expression>("nae1").SingleOrDefault();
			string nae1Name = ExtractExpressionName(ref nae1);
			if (nae1Name == null)
				return false;

			Expression nae2 = match.Get<Expression>("nae2").SingleOrDefault();
			string nae2Name = ExtractExpressionName(ref nae2);
			if (nae2Name == null)
				return false;

			bool introduceLetClause = true;
			var nae1Identifier = nae1 as IdentifierExpression;
			var nae2Identifier = nae2 as IdentifierExpression;
			if (nae1Identifier != null && nae2Identifier != null && nae1Identifier.Identifier == nae1Name && nae2Identifier.Identifier == nae2Name) {
				introduceLetClause = false;
			}

			if (nae1Name != continuationIdentifier) {
				if (nae2Name == continuationIdentifier) {
					//Members are in reversed order
					string tempName = nae1Name;
					Expression tempNae = nae1;

					nae1Name = nae2Name;
					nae1 = nae2;
					nae2Name = tempName;
					nae2 = tempNae;
				} else {
					return false;
				}
			}

			if (introduceLetClause && innerQuery.Clauses.OfType<QueryFromClause>().Any(from => from.Identifier == nae2Name)) {
				return false;
			}
			if (introduceLetClause && innerQuery.Clauses.OfType<QueryJoinClause>().Any(join => join.JoinIdentifier == nae2Name)) {
				return false;
			}

			// from * in (from x in ... select new { x = x, y = expr }) ...
			// =>
			// from x in ... let y = expr ...
			fromClause.Remove();
			selectClause.Remove();
			// Move clauses from innerQuery to query
			QueryClause insertionPos = null;
			foreach (var clause in innerQuery.Clauses) {
				query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
			}
			if (introduceLetClause) {
				query.Clauses.InsertAfter(insertionPos, new QueryLetClause { Identifier = nae2Name, Expression = nae2.Detach() });
			}
			return true;
		}
开发者ID:furesoft,项目名称:NRefactory,代码行数:62,代码来源:CombineQueryExpressions.cs

示例5: VisitQueryFromClause

 public virtual void VisitQueryFromClause(QueryFromClause queryFromClause)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(queryFromClause);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs

示例6: VisitQueryFromClause

 public StringBuilder VisitQueryFromClause(QueryFromClause queryFromClause, int data)
 {
     throw new SLSharpException("SL# does not understand LINQ.");
 }
开发者ID:hach-que,项目名称:SLSharp,代码行数:4,代码来源:VisitorBase.Illegal.cs

示例7: Visit

			public override object Visit (Mono.CSharp.Linq.SelectMany queryStart)
			{
				var fromClause = new QueryFromClause ();
				var location = LocationsBag.GetLocations (queryStart);
				
				fromClause.AddChild (new CSharpTokenNode (Convert (queryStart.Location), "from".Length), QueryFromClause.FromKeywordRole);
				
				if (queryStart.IdentifierType != null)
					fromClause.AddChild (ConvertToType (queryStart.IdentifierType), QueryFromClause.Roles.Type);
				
				fromClause.AddChild (new Identifier (queryStart.IntoVariable.Name, Convert (queryStart.IntoVariable.Location)), QueryFromClause.Roles.Identifier);
				
				if (location != null)
					fromClause.AddChild (new CSharpTokenNode (Convert (location [0]), "in".Length), QueryFromClause.InKeywordRole);
				fromClause.AddChild ((Expression)queryStart.Expr.Accept (this), QueryFromClause.Roles.Expression);
				return fromClause;
			}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:17,代码来源:CSharpParser.cs

示例8: VisitQueryFromClause

 public void VisitQueryFromClause(QueryFromClause queryFromClause)
 {
     throw new NotImplementedException();
 }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:4,代码来源:AstCsToJson.cs

示例9: TryRemoveTransparentIdentifier

		bool TryRemoveTransparentIdentifier(QueryExpression query, QueryFromClause fromClause, QueryExpression innerQuery)
		{
			if (!IsTransparentIdentifier(fromClause.Identifier))
				return false;
			Match match = selectTransparentIdentifierPattern.Match(innerQuery.Clauses.Last());
			if (!match.Success)
				return false;
			QuerySelectClause selectClause = (QuerySelectClause)innerQuery.Clauses.Last();
			NamedExpression nae1 = match.Get<NamedExpression>("nae1").SingleOrDefault();
			NamedExpression nae2 = match.Get<NamedExpression>("nae2").SingleOrDefault();
			if (nae1 != null && nae1.Name != ((IdentifierExpression)nae1.Expression).Identifier)
				return false;
			Expression nae2Expr = match.Get<Expression>("nae2Expr").Single();
			IdentifierExpression nae2IdentExpr = nae2Expr as IdentifierExpression;
			if (nae2IdentExpr != null && (nae2 == null || nae2.Name == nae2IdentExpr.Identifier)) {
				// from * in (from x in ... select new { x = x, y = y }) ...
				// =>
				// from x in ... ...
				fromClause.Remove();
				selectClause.Remove();
				// Move clauses from innerQuery to query
				QueryClause insertionPos = null;
				foreach (var clause in innerQuery.Clauses) {
					query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
				}
			} else {
				// from * in (from x in ... select new { x = x, y = expr }) ...
				// =>
				// from x in ... let y = expr ...
				fromClause.Remove();
				selectClause.Remove();
				// Move clauses from innerQuery to query
				QueryClause insertionPos = null;
				foreach (var clause in innerQuery.Clauses) {
					query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
				}
				string ident;
				if (nae2 != null)
					ident = nae2.Name;
				else if (nae2Expr is IdentifierExpression)
					ident = ((IdentifierExpression)nae2Expr).Identifier;
				else if (nae2Expr is MemberReferenceExpression)
					ident = ((MemberReferenceExpression)nae2Expr).MemberName;
				else
					throw new InvalidOperationException("Could not infer name from initializer in AnonymousTypeCreateExpression");
				query.Clauses.InsertAfter(insertionPos, new QueryLetClause { Identifier = ident, Expression = nae2Expr.Detach() });
			}
			return true;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:49,代码来源:CombineQueryExpressions.cs

示例10: VisitQueryFromClause

			public override void VisitQueryFromClause(QueryFromClause queryFromClause)
			{
				ProcessName(queryFromClause.Identifier);
				base.VisitQueryFromClause(queryFromClause);
			}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:5,代码来源:NamingHelper.cs

示例11: VisitQueryFromClause

		public override void VisitQueryFromClause(QueryFromClause queryFromClause)
		{
			FixClauseIndentation(queryFromClause, queryFromClause.FromKeyword);
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:4,代码来源:FormattingVisitor_Query.cs

示例12: TryRemoveTransparentIdentifier

		bool TryRemoveTransparentIdentifier(QueryExpression query, QueryFromClause fromClause, QueryExpression innerQuery, out string transparentIdentifier)
		{
			transparentIdentifier = fromClause.Identifier;

			Match match = selectTransparentIdentifierPattern.Match(innerQuery.Clauses.Last());
			if (!match.Success)
				return false;
			QuerySelectClause selectClause = (QuerySelectClause)innerQuery.Clauses.Last();
			Expression nae1 = match.Get<Expression>("nae1").SingleOrDefault();
			string nae1Name = ExtractExpressionName(ref nae1);
			if (nae1Name == null)
				return false;

			Expression nae2 = match.Get<Expression>("nae2").SingleOrDefault();
			string nae2Name = ExtractExpressionName(ref nae2);
			if (nae1Name == null)
				return false;

			// from * in (from x in ... select new { x = x, y = expr }) ...
			// =>
			// from x in ... let y = expr ...
			fromClause.Remove();
			selectClause.Remove();
			// Move clauses from innerQuery to query
			QueryClause insertionPos = null;
			foreach (var clause in innerQuery.Clauses) {
				query.Clauses.InsertAfter(insertionPos, insertionPos = clause.Detach());
			}
			query.Clauses.InsertAfter(insertionPos, new QueryLetClause { Identifier = nae2Name, Expression = nae2.Detach() });
			return true;
		}
开发者ID:qhta,项目名称:NRefactory,代码行数:31,代码来源:CombineQueryExpressions.cs

示例13: VisitQueryFromClause

		public virtual void VisitQueryFromClause(QueryFromClause queryFromClause)
		{
			VisitChildren (queryFromClause);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs

示例14: QueryFromClause

/*			public override object Visit (Mono.CSharp.Linq.Query queryExpression)
			{
				var result = new QueryFromClause ();
				var location = LocationsBag.GetLocations (queryExpression);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "from".Length), QueryFromClause.FromKeywordRole);
				// TODO: select identifier
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), "in".Length), QueryFromClause.InKeywordRole);
				var query = queryExpression.Expr as Mono.CSharp.Linq.AQueryClause;
//				if (query != null && query.Expr != null)
//					result.AddChild ((AstNode)query.Expr.Accept (this), QueryFromClause.Roles.Expression);
				return result;
			}				 */
			
			public override object Visit (Mono.CSharp.Linq.SelectMany selectMany)
			{
				var result = new QueryFromClause ();
				// TODO:
//				Mono.CSharp.Linq.Cast cast = selectMany.Expr as Mono.CSharp.Linq.Cast;
				var location = LocationsBag.GetLocations (selectMany);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), "from".Length), QueryFromClause.FromKeywordRole);
				
				//					result.AddChild ((AstNode)cast.TypeExpr.Accept (this), QueryFromClause.Roles.ReturnType);
//				if (cast != null)
				
//				result.AddChild (new Identifier (selectMany.SelectIdentifier.Value, Convert (selectMany.SelectIdentifier.Location)), QueryFromClause.Roles.Identifier);
				//				result.AddChild (new CSharpTokenNode (Convert (location[1]), "in".Length), QueryFromClause.InKeywordRole);
				
				//				result.AddChild ((AstNode)(cast != null ? cast.Expr : selectMany.Expr).Accept (this), QueryFromClause.Roles.Expression);
				
				
				return result;
			}
开发者ID:sandyarmstrong,项目名称:monodevelop,代码行数:35,代码来源:CSharpParser.cs

示例15: VisitQueryFromClause

		public void VisitQueryFromClause(QueryFromClause queryFromClause)
		{
			StartNode(queryFromClause);
			WriteKeyword(QueryFromClause.FromKeywordRole);
			queryFromClause.Type.AcceptVisitor(this);
			Space();
			queryFromClause.IdentifierToken.AcceptVisitor(this);
			Space();
			WriteKeyword(QueryFromClause.InKeywordRole);
			Space();
			queryFromClause.Expression.AcceptVisitor(this);
			EndNode(queryFromClause);
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:13,代码来源:CSharpOutputVisitor.cs


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