Inheritance: SimpleDbExpression
Ejemplo n.º 1
0
 protected override Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     if (qex.Source is ConstantExpression)
     {
         var source = (ConstantExpression)qex.Source;
         if (source.Value is ISimpleDbItemCollection)
         {
             return SimpleDbExpression.Query(
                 qex.Select,
                 SimpleDbExpression.Domain(((ISimpleDbItemCollection)source.Value).Domain),
                 qex.Where,
                 qex.OrderBy,
                 qex.Limit,
                 qex.UseConsistency);
         }
         else
         {
             throw new NotSupportedException(
                 string.Format("Cannot determine data source from '{0}'", source.Value.GetType())
                 );
         }
     }
     else
     {
         Expression source = base.Visit(qex.Source);
         return SimpleDbExpression.Query(
             qex.Select,
             source,
             qex.Where,
             qex.OrderBy,
             qex.Limit,
             qex.UseConsistency);
     }
 }
Ejemplo n.º 2
0
 protected override Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     //if select list is explicit, must ensure attributes referenced in OrderBy are included
     if (qex.Select.Attributes.Count() > 0 && qex.OrderBy.Count() > 0)
     {
         return SimpleDbExpression.Query(
             SimpleDbExpression.Select(
                 qex.Select.Attributes.Union(qex.OrderBy.Select(ob => ob.Attribute))
             ),
             qex.Source,
             qex.Where,
             qex.OrderBy,
             qex.Limit,
             qex.UseConsistency);
     }
     return base.VisitSimpleDbQuery(qex);
 }
Ejemplo n.º 3
0
 public static ProjectionExpression Project(QueryExpression query, Expression projector)
 {
     return new ProjectionExpression(query, projector);
 }
Ejemplo n.º 4
0
 protected override Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     return this.AggregateAndReduce(qex);
 }
Ejemplo n.º 5
0
 protected override Expression VisitSimpleDbQuery(QueryExpression ssex)
 {
     if (ssex.Where != null)
     {
         if (_aggregatedWhere == null)
         {
             _aggregatedWhere = ssex.Where;
         }
         else
         {
             _aggregatedWhere = Expression.AndAlso(_aggregatedWhere, ssex.Where);
         }
     }
     if (ssex.OrderBy != null)
     {
         _aggregatedOrderBy.InsertRange(0, ssex.OrderBy);
     }
     if(ssex.Limit != null)
     {
         _limit = ssex.Limit;
     }
     Visit(ssex.Select);
     _source = ssex.Source;
     if (_source is QueryExpression)
     {
         Visit(ssex.Source);
     }
     if (ssex.UseConsistency == true)
     {
         _useConsistency = true;
     }
     return ssex;
 }
Ejemplo n.º 6
0
 protected virtual Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     return qex;
 }
Ejemplo n.º 7
0
 public ProjectionExpression(QueryExpression source, Expression projector, Expression originalExpression)
 {
     this._source = source;
     this._projector = projector;
     this._originalExpression = originalExpression;
 }
Ejemplo n.º 8
0
 public ProjectionExpression(QueryExpression source, Expression projector)
     : this(source, projector, null)
 {
 }
Ejemplo n.º 9
0
 internal QueryCommand(QueryExpression query)
 {
     _query = query;
     _queryText = QueryWriter.Write(query);
 }