private FilterDefinition <TEntity> GetFilter <TEntity>(QueryUnion queryUnion)
            where TEntity : Entity
        {
            var filters = queryUnion.Queries.Select(q => GetFilter <TEntity>(q));

            if (queryUnion.Operand == QueryUnionOperands.And)
            {
                return(Builders <TEntity> .Filter.And(filters));
            }
            else
            {
                return(Builders <TEntity> .Filter.Or(filters));
            }
        }
示例#2
0
 public virtual Node VisitQueryUnion(QueryUnion union, QueryUnion changes, QueryUnion deletions, QueryUnion insertions){
   this.UpdateSourceContext(union, changes);
   if (union == null) return changes;
   if (changes != null){
     if (deletions == null || insertions == null)
       Debug.Assert(false);
     else{
     }
   }else if (deletions != null)
     return null;
   return union;
 }
    public virtual Differences VisitQueryUnion(QueryUnion union1, QueryUnion union2){
      Differences differences = new Differences(union1, union2);
      if (union1 == null || union2 == null){
        if (union1 != union2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      QueryUnion changes = (QueryUnion)union2.Clone();
      QueryUnion deletions = (QueryUnion)union2.Clone();
      QueryUnion insertions = (QueryUnion)union2.Clone();

      //      union1.LeftSource;
      //      union1.RightSource;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
示例#4
0
 public virtual Node VisitQueryUnion(QueryUnion union){
   if (union == null) return null;
   union.LeftSource = this.VisitExpression(union.LeftSource);
   union.RightSource = this.VisitExpression(union.RightSource);
   return union;
 }
示例#5
0
 public override Node VisitQueryUnion(QueryUnion qu) {
   if (qu == null) return null;
   qu.LeftSource = this.VisitExpression(qu.LeftSource);
   qu.RightSource = this.VisitExpression(qu.RightSource);
   if (qu.LeftSource == null || qu.LeftSource.Type == null ||
     qu.RightSource == null || qu.RightSource.Type == null) return null;
   Cardinality card = this.typeSystem.GetCardinality(qu.LeftSource, this.TypeViewer);
   if (card != Cardinality.OneOrMore && card != Cardinality.ZeroOrMore) {
     this.HandleError(qu.LeftSource, Error.QueryNotStream);
     return null;
   }
   card = this.typeSystem.GetCardinality(qu.RightSource, this.TypeViewer);
   if (card != Cardinality.OneOrMore && card != Cardinality.ZeroOrMore) {
     this.HandleError(qu.RightSource, Error.QueryNotStream);
     return null;
   }
   if (qu.LeftSource.Type.UniqueKey != qu.RightSource.Type.UniqueKey) {
     this.HandleError(qu, Error.QueryBadUnionTypes, this.GetTypeName(qu.LeftSource.Type), this.GetTypeName(qu.RightSource.Type));
     return null;
   }
   if (qu.Type == null) return null;
   this.HandleError(qu, Error.QueryNotSupported);
   return null;
 }
示例#6
0
 public override Node VisitQueryUnion( QueryUnion union ){
   if (union == null) return null;
   union.LeftSource = this.VisitExpression(union.LeftSource);
   union.RightSource = this.VisitExpression(union.RightSource);
   if (union.LeftSource != null && union.RightSource != null &&
     union.LeftSource.Type != null && union.RightSource.Type != null ){
     union.Type = union.LeftSource.Type; // hack for now
   }
   return union;
 }
示例#7
0
 public virtual void VisitQueryUnion(QueryUnion union){
   if (union == null) return;
   this.VisitExpression(union.LeftSource);
   this.VisitExpression(union.RightSource);
 }
示例#8
0
 public override Node VisitQueryUnion(QueryUnion union){
   if (union == null) return null;
   return base.VisitQueryUnion((QueryUnion)union.Clone());
 }
示例#9
0
 public virtual Node VisitQueryUnion(QueryUnion union1, QueryUnion union2){
   if (union1 == null) return null;
   if (union2 == null){
     union1.LeftSource = this.VisitExpression(union1.LeftSource, null);
     union1.RightSource = this.VisitExpression(union1.RightSource, null);
   }else{
     union1.LeftSource = this.VisitExpression(union1.LeftSource, union2.LeftSource);
     union1.RightSource = this.VisitExpression(union1.RightSource, union2.RightSource);
   }
   return union1;
 }
示例#10
0
 public override Node VisitQueryUnion( QueryUnion union ) {
   base.VisitQueryUnion(union);
   return this.Compose(union, this.GetComposer(union.LeftSource), this.GetComposer(union.RightSource));
 }
示例#11
0
 public override Node VisitQueryUnion(QueryUnion union)
 {
     base.VisitQueryUnion(union);
     return(this.Compose(union, this.GetComposer(union.LeftSource), this.GetComposer(union.RightSource)));
 }
 public EventingVisitor(Action<QueryUnion> visitQueryUnion) { VisitedQueryUnion += visitQueryUnion; } public event Action<QueryUnion> VisitedQueryUnion; public override Node VisitQueryUnion(QueryUnion union) { if (VisitedQueryUnion != null) VisitedQueryUnion(union); return base.VisitQueryUnion(union); }