public override void VisitTo(IOqlExpressionVisitor visitor) { visitor.Query.AppendInsert().AppendType(visitor.SourceType).AppendBeginExpression(); Expression val; List <Expression> vals = new List <Expression>(); IDataChange dc = m_change_set.First(); val = dc.NewValue; visitor.Query.AppendMember(dc.PropertyOrField); foreach (IDataChange x in m_change_set.Skip(1)) { visitor.Query.AppendExpressionSeparator(); visitor.Query.AppendMember(x.PropertyOrField); } visitor.Query.AppendEndExpression().AppendValues().AppendBeginExpression(); visitor.Visit(val); foreach (Expression x in vals) { visitor.Query.AppendExpressionSeparator(); visitor.Visit(x); } visitor.Query.AppendEndExpression(); }
public override void FormatMethodCall(IOqlExpressionVisitor visitor, MethodCallExpression methodCall) { if (methodCall.Method.DeclaringType == typeof(Enumerable)) { visitor.Query.AppendBeginExpression(); visitor.Visit(methodCall.Arguments[1]); visitor.Query.AppendIn(); visitor.Visit(methodCall.Arguments.First()); visitor.Query.AppendEndExpression(); return; } if (methodCall.Method.DeclaringType == typeof(Queryable)) { visitor.Query.AppendBeginExpression(); visitor.Visit(methodCall.Arguments[1]); visitor.Query.AppendIn(); IQueryable query = methodCall.Arguments.First().GetValue() as IQueryable; visitor.VisitSubQuery(query.Expression); visitor.Query.AppendEndExpression(); return; } visitor.Query.AppendBeginExpression(); visitor.Visit(methodCall.Object); visitor.Query.AppendLike(); visitor.VisitSearchPattern(true, methodCall.Arguments.First(), true); visitor.Query.AppendEndExpression(); }
public void FormatAnd(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendAndAlso(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public void FormatNotEqual(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendNotEqual(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public void FormatGreaterThan(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendGreaterThan(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public void FormatOr(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendOrElse(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public void FormatSubtractChecked(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendSubtract(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public void FormatMultiply(IOqlExpressionVisitor visitor, Expression left, Expression right) { visitor.Query.AppendBeginExpression(); visitor.Visit(left); visitor.Query.AppendMultiply(); visitor.Visit(right); visitor.Query.AppendEndExpression(); }
public override void VisitTo(IOqlExpressionVisitor visitor) { visitor.Query.AppendUpdate().AppendType(visitor.SourceType).AppendSet(); IDataChange dc = ChangeSet.First(); visitor.Query.AppendMember(dc.PropertyOrField).AppendAssign(); visitor.Visit(dc.NewValue); foreach (IDataChange x in ChangeSet.Skip(1)) { visitor.Query.AppendExpressionSeparator().AppendMember(dc.PropertyOrField).AppendAssign(); visitor.Visit(dc.NewValue); } }
public void FormatNot(IOqlExpressionVisitor visitor, Expression operand) { visitor.Query.AppendNot(); visitor.Query.AppendBeginExpression(); visitor.Visit(operand); visitor.Query.AppendEndExpression(); }
public override void FormatMethodCall(IOqlExpressionVisitor visitor, MethodCallExpression method) { visitor.Query.AppendBeginExpression(); visitor.Visit(method.Object); visitor.Query.AppendLike(); visitor.VisitSearchPattern(false, method.Arguments.First(), true); visitor.Query.AppendEndExpression(); }
public override void VisitTo(IOqlExpressionVisitor visitor) { if (m_expression != null) { visitor.Query.AppendWhere(); visitor.Visit(m_expression); } }
public override void VisitTo(IOqlExpressionVisitor visitor) { if (visit_to_aggregate != null) { visitor.Query.AppendSelect().AppendBlank(); visit_to_aggregate(visitor, m_select_expression); return; } if (visitor.Context.CallResult.Command == OqlCommandToken.Scalar) { visitor.Query.AppendSelect().AppendBlank(); visitor.Context.AggregateFormatter.FormatCount(visitor); return; } if (visitor.Context.CallResult.Command == OqlCommandToken.IsAny) { visitor.Query.AppendSelect().AppendTop(1).AppendBlank().AppendMultiply(); return; } if (visitor.Context.CallResult.Command == OqlCommandToken.IsAll) { visitor.Query.AppendSelect().AppendBlank().AppendMultiply(); return; } VisitForSelect(visitor); if (m_select_expression == null) { IEnumerable <MemberInfo> members = visitor.SourceType.SelectMembers(); if (members.Any()) { visitor.Query.AppendMember(members.First()); foreach (MemberInfo x in members.Skip(1)) { visitor.Query.AppendExpressionSeparator(); visitor.Query.AppendMember(x); } } return; } visitor.Visit(m_select_expression); }
protected virtual void VisitOrderBy(IOqlExpressionVisitor visitor, MethodCallExpression methodCall) { visitor.Visit(methodCall.GetArgument(1)); if (methodCall.IsCalledOr(OrderBy, ThenBy)) { visitor.Query.AppendAsc(); return; } if (methodCall.IsCalledOr(OrderByDescending, ThenByDescending)) { visitor.Query.AppendDesc(); } }
public Expression ProcessMethodCall(IOqlExpressionVisitor caller, MethodCallExpression methodCall) { IOqlMethodCallEntry methodEntry = base[methodCall]; if (methodEntry != null) { IOqlClause clause = methodEntry.Clause; if (clause != null) { clause.ProcessMethodCall(this, methodCall); } IOqlMethodCallFormatter formatter = methodEntry.Formatter; if (formatter != null) { formatter.FormatMethodCall(caller, methodCall); return(methodCall); } } return(caller.Visit(methodCall.Arguments[0])); }
public void FormatAverage(IOqlExpressionVisitor visitor, Expression operand) { visitor.Query.AppendAvg().AppendBeginExpression(); visitor.Visit(operand); visitor.Query.AppendEndExpression(); }
public void FormatUnaryPlus(IOqlExpressionVisitor visitor, Expression operand) { visitor.Query.AppendPlus().AppendBeginExpression(); visitor.Visit(operand); visitor.Query.AppendEndExpression(); }