Skip to content

Honor IndexAttribute on header collection mappings - #2389

Open
justadityaraj wants to merge 1 commit into
JoshClose:masterfrom
justadityaraj:fix-2364-index-attribute
Open

Honor IndexAttribute on header collection mappings#2389
justadityaraj wants to merge 1 commit into
JoshClose:masterfrom
justadityaraj:fix-2364-index-attribute

Conversation

@justadityaraj

Copy link
Copy Markdown

Problem

With headers enabled, auto-mapping dropped every enumerable member before applying its attributes. A collection declared with [Index(...)] was therefore left unmapped, even though the equivalent explicit ClassMap worked.

Fix

Keep skipping unindexed enumerable members, but retain collections that declare an IndexAttribute. Add a regression test for the reported [Index(2, -1)] case.

User impact

Collection properties can now use index ranges with attribute-based mapping when a CSV has headers, matching explicit class-map behavior.

Verification

  • Collection converter tests: 3 passed
  • Type-conversion tests: 146 passed; the same 2 Windows newline assertions fail on clean master
  • Full net9.0 test suite: 1,062 passed; only those same 2 baseline newline assertions failed
  • git diff --check

Fixes #2364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Index Attribute seems not to map to List<T>, but via ClassMap it works

1 participant