Skip to content

feature: ReflectionSource and DictionarySource - #426

Merged
axunonb merged 6 commits into
axuno:mainfrom
axunonb:pr/reflection-dict-source
Jul 2, 2024
Merged

axunonb merged 6 commits into
axuno:mainfrom
axunonb:pr/reflection-dict-source

Conversation

@axunonb

@axunonb axunonb commented Jun 29, 2024 •

Copy link
Copy Markdown
Member

Closes #425

Changes to ReflectionSource

  • Modified ReflectionSource.TypeCache to be static, shared across all instances.
  • Implemented a control mechanism for the size of ReflectionSource.TypeCache. When the cache exceeds the maximum size limit, it now removes the oldest entry first, adhering to a First-In-First-Out (FIFO) strategy.
  • Enhanced documentation for CaseSensitivityType.CaseInsensitive: Clarified that in scenarios where multiple members share the same name but differ in case, the first encountered member will be selected.

Updates to DictionarySource

  • Correction: Ensured that generic dictionaries and dynamic objects respect the case sensitivity settings.
  • Added to the documentation: Specified that the cache for IReadOnlyDictionary is deliberately scoped to the instance level.

axunonb added 5 commits June 28, 2024 23:09
* Make ReflectionSource.TypeCache static
* Control size of ReflectionSource.TypeCache, remove oldest item first
* dynamics in DictionarySource also use case-sensitivity setting
* Cache for IReadOnlyDictionary has instance scope
Only before NETCore3.1, the dictionary is not ordered by insertion order.
* Add comment about handling case-sensitivity
* Add test for: When there are multiple members with the same name but different case, the first member is used
* for DictionarySource
* for ReflectionSource
@axunonb
axunonb requested a review from karljj1 June 29, 2024 14:24
@axunonb axunonb changed the title feature: RelectionSource and DictionarySource feature: ReflectionSource and DictionarySource Jun 29, 2024
@codecov

codecov Bot commented Jun 29, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97%. Comparing base (421c715) to head (1099e09).

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #426   +/-   ##
===================================
  Coverage    97%    97%           
===================================
  Files        96     96           
  Lines      3400   3422   +22     
===================================
+ Hits       3282   3304   +22     
  Misses      118    118           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread src/SmartFormat/Extensions/ReflectionSource.cs
@axunonb

axunonb commented Jul 2, 2024

Copy link
Copy Markdown
Member Author

Thanks for the review. Wiki is updated accordingly.

@axunonb
axunonb merged commit 2bf827f into axuno:main Jul 2, 2024
@axunonb
axunonb deleted the pr/reflection-dict-source branch July 2, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static cache for ReflectionSource and DictionarySource?

2 participants