This repository was archived by the owner on Jun 16, 2024. It is now read-only.
Correctly translating FetchXml with multiple filter nodes#507
Open
BetimBeja wants to merge 2 commits intojordimontana82:masterfrom
Open
Correctly translating FetchXml with multiple filter nodes#507BetimBeja wants to merge 2 commits intojordimontana82:masterfrom
BetimBeja wants to merge 2 commits intojordimontana82:masterfrom
Conversation
Owner
|
recheck |
TarogStar
pushed a commit
to TarogStar/fake-xrm-easy
that referenced
this pull request
Nov 11, 2025
…s and left outer joins This commit addresses critical FetchXML and query translation issues identified from upstream repository analysis, significantly improving query compatibility with real Dataverse behavior. **Fix jordimontana82#1: FetchXML Multiple Filter Elements** (Resolves jordimontana82#507) **Problem:** - FetchXML allowed multiple <filter> elements at the same level - Framework only processed the FIRST filter, ignoring all others - This affected both entity-level and link-entity filters **Solution:** - Modified XmlExtensionsForFetchXml.cs ToCriteria() method (lines 217-241) - Now collects ALL filter elements and combines with AND logic - Modified ToLinkEntity() method (lines 302-321) for link-entity filters - Matches real Dataverse behavior where multiple filters are AND'ed **Files Changed:** - FakeXrmEasy.Shared/Extensions/XmlExtensionsForFetchXml.cs **Impact:** - HIGH - FetchXML queries with multiple filters now work correctly - Enables complex filtering scenarios previously impossible - 100% backward compatible (single filter still works) --- **Fix jordimontana82#2: Nested Left Outer Join Support** (Resolves jordimontana82#503) **Problem:** - Left outer joins with nested link-entities failed - Nested entities were not included in the inner query - Resulted in null reference errors or missing data - Issue jordimontana82#191 documented this specific problem **Solution:** - Modified XrmFakedContext.Queries.cs TranslateLinkedEntityToLinq() (lines 333-355) - For LeftOuter joins, nested LinkEntities now added to inner QueryExpression - Skip redundant recursive processing for LeftOuter joins (lines 402-420) - Ensures nested joins processed BEFORE outer join executes **Files Changed:** - FakeXrmEasy.Shared/XrmFakedContext.Queries.cs **Impact:** - HIGH - Nested left outer joins now work correctly - Critical for complex reporting queries - Fixes long-standing issue from upstream repository --- **Test Coverage:** Created comprehensive test suites: 1. **MultipleFiltersTests.cs** (9 tests): - Single filter (backward compatibility) - Two filters combined with AND - Three filters combined with AND - Multiple filters with OR type - Link-entity multiple filters - Empty filters - Nested filters within multiple top filters - QueryExpression equivalence verification 2. **LeftOuterJoinTests.cs** (8 tests): - Basic left outer join with no match - Nested left outer joins (2-4 levels deep) - FetchXML left outer joins - Filtered left outer joins - Multiple left outer joins at same level - Mixed inner and left outer joins - Deep nested left outer joins **Total:** 17 new tests, all covering edge cases and real-world scenarios --- **Upstream Issues Resolved:** - jordimontana82#507 - FetchXML with multiple filter nodes - jordimontana82#503 - Left outer join fixes - jordimontana82#191 - Nested left outer joins **Compatibility:** - All changes are backward compatible - Existing queries continue to work unchanged - New functionality only activates when using multiple filters or nested joins This represents a major improvement in query engine reliability and Dataverse compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello Jordi,
this fixes Bug #506.
Betim.