本文整理汇总了C#中QueryOrderClause类的典型用法代码示例。如果您正苦于以下问题:C# QueryOrderClause类的具体用法?C# QueryOrderClause怎么用?C# QueryOrderClause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryOrderClause类属于命名空间,在下文中一共展示了QueryOrderClause类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitQueryOrderClause
public void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
StartNode(queryOrderClause);
WriteKeyword(QueryOrderClause.OrderbyKeywordRole);
Space();
WriteCommaSeparatedList(queryOrderClause.Orderings);
EndNode(queryOrderClause);
}
示例2: Visit
public override object Visit(Mono.CSharp.Linq.OrderByDescending orderByDescending)
{
currentQueryOrderClause = new QueryOrderClause();
var ordering = new QueryOrdering();
if (orderByDescending.Expr != null)
ordering.AddChild((Expression)orderByDescending.Expr.Accept(this), Roles.Expression);
var location = LocationsBag.GetLocations(orderByDescending);
if (location != null) {
ordering.Direction = QueryOrderingDirection.Descending;
ordering.AddChild(new CSharpTokenNode(Convert(location [0]), QueryOrdering.DescendingKeywordRole), QueryOrdering.DescendingKeywordRole);
}
currentQueryOrderClause.AddChild(ordering, QueryOrderClause.OrderingRole);
return currentQueryOrderClause;
}
示例3: VisitQueryOrderClause
public virtual void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
VisitChildren (queryOrderClause);
}
示例4: Visit
public override object Visit (Mono.CSharp.Linq.ThenByDescending thenByDescending)
{
var result = new QueryOrderClause ();
var ordering = new QueryOrdering ();
ordering.AddChild ((Expression)thenByDescending.Expr.Accept (this), QueryWhereClause.Roles.Expression);
var location = LocationsBag.GetLocations (thenByDescending);
if (location != null) {
ordering.Direction = QueryOrderingDirection.Descending;
ordering.AddChild (new CSharpTokenNode (Convert (location[0]), "ascending".Length), QueryWhereClause.Roles.Keyword);
}
result.AddChild (ordering, QueryOrderClause.OrderingRole);
return result;
}
示例5: VisitQueryOrderClause
public virtual void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(queryOrderClause);
}
}
示例6: DecompileQuery
QueryExpression DecompileQuery(InvocationExpression invocation)
{
if (invocation == null)
return null;
MemberReferenceExpression mre = invocation.Target as MemberReferenceExpression;
if (mre == null)
return null;
switch (mre.MemberName) {
case "Select":
{
if (invocation.Arguments.Count != 1)
return null;
string parameterName;
Expression body;
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameterName, out body)) {
QueryExpression query = new QueryExpression();
query.Clauses.Add(new QueryFromClause { Identifier = parameterName, Expression = mre.Target.Detach() });
query.Clauses.Add(new QuerySelectClause { Expression = body.Detach() });
return query;
}
return null;
}
case "GroupBy":
{
if (invocation.Arguments.Count == 2) {
string parameterName1, parameterName2;
Expression keySelector, elementSelector;
if (MatchSimpleLambda(invocation.Arguments.ElementAt(0), out parameterName1, out keySelector)
&& MatchSimpleLambda(invocation.Arguments.ElementAt(1), out parameterName2, out elementSelector)
&& parameterName1 == parameterName2)
{
QueryExpression query = new QueryExpression();
query.Clauses.Add(new QueryFromClause { Identifier = parameterName1, Expression = mre.Target.Detach() });
query.Clauses.Add(new QueryGroupClause { Projection = elementSelector.Detach(), Key = keySelector.Detach() });
return query;
}
} else if (invocation.Arguments.Count == 1) {
string parameterName;
Expression keySelector;
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameterName, out keySelector)) {
QueryExpression query = new QueryExpression();
query.Clauses.Add(new QueryFromClause { Identifier = parameterName, Expression = mre.Target.Detach() });
query.Clauses.Add(new QueryGroupClause { Projection = new IdentifierExpression(parameterName), Key = keySelector.Detach() });
return query;
}
}
return null;
}
case "SelectMany":
{
if (invocation.Arguments.Count != 2)
return null;
string parameterName;
Expression collectionSelector;
if (!MatchSimpleLambda(invocation.Arguments.ElementAt(0), out parameterName, out collectionSelector))
return null;
LambdaExpression lambda = invocation.Arguments.ElementAt(1) as LambdaExpression;
if (lambda != null && lambda.Parameters.Count == 2 && lambda.Body is Expression) {
ParameterDeclaration p1 = lambda.Parameters.ElementAt(0);
ParameterDeclaration p2 = lambda.Parameters.ElementAt(1);
if (p1.Name == parameterName) {
QueryExpression query = new QueryExpression();
query.Clauses.Add(new QueryFromClause { Identifier = p1.Name, Expression = mre.Target.Detach() });
query.Clauses.Add(new QueryFromClause { Identifier = p2.Name, Expression = collectionSelector.Detach() });
query.Clauses.Add(new QuerySelectClause { Expression = ((Expression)lambda.Body).Detach() });
return query;
}
}
return null;
}
case "Where":
{
if (invocation.Arguments.Count != 1)
return null;
string parameterName;
Expression body;
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameterName, out body)) {
QueryExpression query = new QueryExpression();
query.Clauses.Add(new QueryFromClause { Identifier = parameterName, Expression = mre.Target.Detach() });
query.Clauses.Add(new QueryWhereClause { Condition = body.Detach() });
return query;
}
return null;
}
case "OrderBy":
case "OrderByDescending":
case "ThenBy":
case "ThenByDescending":
{
if (invocation.Arguments.Count != 1)
return null;
string parameterName;
Expression orderExpression;
if (MatchSimpleLambda(invocation.Arguments.Single(), out parameterName, out orderExpression)) {
if (ValidateThenByChain(invocation, parameterName)) {
QueryOrderClause orderClause = new QueryOrderClause();
InvocationExpression tmp = invocation;
while (mre.MemberName == "ThenBy" || mre.MemberName == "ThenByDescending") {
// insert new ordering at beginning
orderClause.Orderings.InsertAfter(
//.........这里部分代码省略.........
示例7: Visit
public override object Visit (Mono.CSharp.Linq.ThenByDescending thenByDescending)
{
var result = new QueryOrderClause ();
/* result.OrderAscending = false;
result.AddChild ((AstNode)thenByDescending.Expr.Accept (this), QueryWhereClause.Roles.Expression);
var location = LocationsBag.GetLocations (thenByDescending);
if (location != null)
result.AddChild (new CSharpTokenNode (Convert (location[0]), "descending".Length), QueryWhereClause.Roles.Keyword);*/
return result;
}
示例8: VisitQueryOrderClause
public StringBuilder VisitQueryOrderClause(QueryOrderClause queryOrderClause, int data)
{
throw new SLSharpException("SL# does not understand LINQ.");
}
示例9: VisitQueryOrderClause
public override void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
base.VisitQueryOrderClause(queryOrderClause);
indexData.HasOrder = true;
}
示例10: VisitQueryOrderClause
public override void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
FixClauseIndentation(queryOrderClause, queryOrderClause.OrderbyToken);
}
示例11: VisitQueryOrderClause
public virtual void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
DebugExpression(queryOrderClause);
StartNode(queryOrderClause);
WriteKeyword(QueryOrderClause.OrderbyKeywordRole);
Space();
WriteCommaSeparatedList(queryOrderClause.Orderings);
EndNode(queryOrderClause);
}
示例12: VisitQueryOrderClause
public void VisitQueryOrderClause(QueryOrderClause queryOrderClause)
{
throw new NotImplementedException();
}
示例13: VisitQueryOrderClause
public void VisitQueryOrderClause(QueryOrderClause node)
{
NotSupported(node);
}