Наследование: SimpleDbExpression
Пример #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);
     }
 }
Пример #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);
 }
Пример #3
0
 public static ProjectionExpression Project(QueryExpression query, Expression projector)
 {
     return new ProjectionExpression(query, projector);
 }
Пример #4
0
 protected override Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     return this.AggregateAndReduce(qex);
 }
Пример #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;
 }
 protected virtual Expression VisitSimpleDbQuery(QueryExpression qex)
 {
     return qex;
 }
Пример #7
0
 public ProjectionExpression(QueryExpression source, Expression projector, Expression originalExpression)
 {
     this._source = source;
     this._projector = projector;
     this._originalExpression = originalExpression;
 }
Пример #8
0
 public ProjectionExpression(QueryExpression source, Expression projector)
     : this(source, projector, null)
 {
 }
Пример #9
0
 internal QueryCommand(QueryExpression query)
 {
     _query = query;
     _queryText = QueryWriter.Write(query);
 }