jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
856 stars 145 forks source link

Fix false-positive duplicate detection in mapping deep member paths to TVP columns #488

Closed sharpjs closed 1 year ago

sharpjs commented 1 year ago

Description

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:

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)

jonwagner commented 1 year ago

awesome! I have a holiday break coming up so it's about time for a new build

jonwagner commented 1 year ago

alrighty 6.3.11 is out