This PR deals with mapping deep member paths to table-valued parameter columns. Suppose a custom column mapper creates the following mappings:
TVP Column
Member Path
A_X
A.X
B_X
B.X
The column-mapping code attempts to deduplicate mappings by keeping a HashSet of used members. When the code finds a member in the HashSet, the code knows that a mapping used the member already. The code then avoids another mapping to the member.
The key for duplicate detection is the ClassPropInfo of the final member in the member path. This causes false-positive duplicate detection in several scenarios, including:
TVP with multiple children of the same type
class Parent
{
public Child A;
public Child B;
}
class Child
{
public int X;
}
TVP with multiple children of different types that each inherit a property from the same base class
class Parent
{
public ChildA A;
public ChildB B;
}
class ChildA : Child { /*...*/ }
class ChildB : Child { /*...*/ }
abstract class Child
{
public int X;
}
This PR supports such scenarios by changing the duplicate detection key to the member path itself.
Checklist
Please make sure your pull request fulfills the following requirements:
[x] Tests for any changes have been added (for bug fixes / features).
[x] Docs have been added / updated (for bug fixes / features).
As far as I know, no documentation needs to be changed.
Type
This pull request includes what type of changes?
[x] Bug.
[ ] Feature.
[ ] Code style update (formatting, local variables).
[ ] Refactoring (no functional changes, no api changes).
[ ] Documentation content changes.
[ ] Other (please describe below).
Breaking Changes
Does this pull request introduce any breaking changes?
[ ] Yes
[x] No ... unless you depend on arguably buggy behaviour
This change causes parameter data to flow to TVP columns where it previously has not.
Description
This PR deals with mapping deep member paths to table-valued parameter columns. Suppose a custom column mapper creates the following mappings:
A_X
A.X
B_X
B.X
The column-mapping code attempts to deduplicate mappings by keeping a
HashSet
of used members. When the code finds a member in theHashSet
, the code knows that a mapping used the member already. The code then avoids another mapping to the member.The key for duplicate detection is the
ClassPropInfo
of the final member in the member path. This causes false-positive duplicate detection in several scenarios, including:TVP with multiple children of the same type
TVP with multiple children of different types that each inherit a property from the same base class
This PR supports such scenarios by changing the duplicate detection key to the member path itself.
Checklist
Please make sure your pull request fulfills the following requirements:
Type
This pull request includes what type of changes?
Breaking Changes
Does this pull request introduce any breaking changes?
This change causes parameter data to flow to TVP columns where it previously has not.
Any other comment
(n/a)