public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStructConstantChildren(this, visitor);
 }
Beispiel #2
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitClassFieldChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitInterfaceReferenceChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStaticClassAutoPropertyAccessorChildren(this, visitor);
 }
Beispiel #5
0
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitClassNestedClassChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStructEventChildren(this, visitor);
 }
Beispiel #7
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitTypeChildren(this, visitor);
 }
Beispiel #8
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitIndexerChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStructCollectionChildren(this, visitor);
 }
Beispiel #10
0
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStaticTypeChildren(this, visitor);
 }
Beispiel #11
0
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitSealedClassIndexerCollectionChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitClassConstructorChildren(this, visitor);
 }
Beispiel #13
0
        protected virtual JoinQuery CreateJoinQuery(IExecutionContext context, [NotNull] IMultiPartQuery query, Expression joinFilter)
        {
            var filterParts = (query.FilterExpression == null ? joinFilter : Expression.AndAlso(query.GetFilter(context), joinFilter)).SplitByAndExpressions();

            // Get all parts of the query that contain fields from both sources.
            var joinParts = filterParts.OfType <CompareExpression>()
                            .Where(comparison =>
            {
                var fields = comparison.GetFields().Select(f => f.SourceAlias).ToArray();
                return(fields.Intersect(this.Left.Aliases).Any() && fields.Intersect(this.Right.Aliases).Any());
            })
                            .ToArray();

            // What's left are the filters for only one source. These we can split in a left part, a right part, and a filter part over the result.
            var filter         = filterParts.Except(joinParts, new ExpressionComparer()).DefaultIfEmpty().Aggregate(Expression.AndAlso);
            var leftFilter     = filter.RemoveAllPartsThatAreNotInSource(this.Left);
            var rightFilter    = filter.RemoveAllPartsThatAreNotInSource(this.Right);
            var resultFilter   = filter.Except(leftFilter, rightFilter);
            var joinExpression = joinParts.OrderBy(p => p, new MostSpecificComparer()).First().MoveFieldsToTheLeft(this.Left);
            var ascending      = joinExpression.CompareType != ExpressionType.GreaterThan && joinExpression.CompareType != ExpressionType.GreaterThanOrEqual;

            var leftQuery = new MultiPartQuery
            {
                Fields = query.Fields
                         .Where(f => this.Left.Aliases.Contains(f.SourceAlias))
                         .Concat(joinParts.SelectMany(l => l.GetDataSourceFields(this.Left)))
                         .Concat(resultFilter.GetDataSourceFields(this.Left))
                         .Distinct(),
                FilterExpression   = leftFilter,
                OrderByExpressions = new[]
                {
                    new OrderByExpression(joinExpression.Left, ascending)
                },
            };

            var rightQuery = new MultiPartQuery
            {
                Fields = query.Fields
                         .Where(f => this.Right.Aliases.Contains(f.SourceAlias))
                         .Concat(joinParts.SelectMany(l => l.GetDataSourceFields(this.Right)))
                         .Concat(resultFilter.GetDataSourceFields(this.Right))
                         .Distinct(),
                FilterExpression   = rightFilter,
                OrderByExpressions = new[]
                {
                    new OrderByExpression(joinExpression.Right, ascending)
                },
            };

            var exraJoinFilter = GenericVisitor.Visit(
                (ExecutionContextExpression e) => Expression.Constant(context),
                joinParts.Skip(1).DefaultIfEmpty().Aggregate <Expression>(Expression.AndAlso));

            return(new JoinQuery(
                       leftQuery,
                       rightQuery,
                       joinExpression.Left.GetRowExpression <Row>(),
                       joinExpression.CompareType,
                       joinExpression.Right.GetRowExpression <Row>(),
                       joinParts.DefaultIfEmpty <Expression>().Aggregate(Expression.AndAlso),
                       exraJoinFilter.GetJoinFunction(this.Left),
                       query.OrderByExpressions,
                       resultFilter));
        }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitSealedClassPropertyChildren(this, visitor);
 }
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitParameterChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStaticClassNestedStructChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitConstantGroupChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStructNestedAbstractPartialClassChildren(this, visitor);
 }
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitSealedClassMethodCollectionChildren(this, visitor);
 }
Beispiel #20
0
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitPartialStructChildren(this, visitor);
 }
 public Task AcceptChildrenAsync(IGenericVisitor visitor)
 {
     return(GenericVisitor.VisitDocumentChildrenAsync(this, visitor));
 }
Beispiel #22
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitDestructor(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitClassIndexerChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitStaticClassEventCollectionChildren(this, visitor);
 }
Beispiel #25
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitNestedEnumMemberChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitAbstractAccessorChildren(this, visitor);
 }
Beispiel #27
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitAbstractClassIndexerCollectionChildren(this, visitor);
 }
Beispiel #28
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitConversionOperatorChildren(this, visitor);
 }
 public override void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitAbstractPartialClassMethodCollectionChildren(this, visitor);
 }
Beispiel #30
0
 public void AcceptChildren(IGenericVisitor visitor)
 {
     GenericVisitor.VisitNestedDelegateChildren(this, visitor);
 }