Skip to content

Add custom attribute property name lookup to configuration binder. - #2810

Closed
Coderrob wants to merge 1 commit into
dotnet:masterfrom
Coderrob:attribute-binding
Closed

Coderrob wants to merge 1 commit into
dotnet:masterfrom
Coderrob:attribute-binding

Conversation

@Coderrob

Copy link
Copy Markdown

Took a swag at addressing the gap between the Json source and the Binder projects. The Json settings I work with contain names that don't match the setting classes. Those are mapped by JsonProperty or DataMember where a name is given that can be mapped.

The binder project, rightfully, doesn't know about Json or any other formats. The one area where it could be built up more is around looking at the attributes associated with the properties of the object it's attempting to bind to the configuration dictionary. This is an attempt to try to just that.

Summary of the changes (Less than 80 chars)

  • Added new BindingOption flag for binding by attribute names
  • Broke out the property value lookup into a standalone function
  • Added a function to return "name" values from custom attribute data from the PropertyType

Addresses #2809 (in this specific format)

…ibute name properties. Useful when working with loading Json as a configuration source to bridge the gap between property name and object's attribute name.
@Coderrob

Coderrob commented Dec 29, 2019 •

Copy link
Copy Markdown
Author

Not entirely sure why all but linux tests are failing for the CI. I've built locally (Win 10 Pro) and run the project tests. No new files were added and project reference changes were not required. Will wipe and pull PR branch locally again to re-run tests.

@ghost

ghost commented Mar 28, 2020

Copy link
Copy Markdown

As per aspnet/Announcements#411, we are currently migrating components from this repository to other repositories. This PR targets components that have been moved to dotnet/runtime, in the src/libraries directory. If you're still interested in contributing this change, please retarget your PR to dotnet/runtime and reference the original issue discussing the change or bug fix. If you have questions, or need guidance on how to port your change, please tag @dotnet/extensions-migration in a comment and we'll try to help.

@ghost ghost locked as resolved and limited conversation to collaborators May 26, 2023
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants