Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IConfiguration append additional property #56301

Closed
eiriktsarpalis opened this issue Jul 26, 2021 · 4 comments
Closed

IConfiguration append additional property #56301

eiriktsarpalis opened this issue Jul 26, 2021 · 4 comments
Labels
area-Extensions-Options untriaged New issue has not been triaged by the area owner

Comments

@eiriktsarpalis
Copy link
Member

Side note related to same problem in different area of the stack: Even if this solves the problem for System.Text.Json, I have the same problem for Microsoft.Extensions.Options when binding an options class with a polymorphic list, to an IConfiguration section. In this case the a json file is first read by ConfigurationBuilder.AddJsonFile("appsettings.json") and ends up as essentially key value pairs. The descriminator property is now a key value pair in the IConfiguration. When materialising IOptions from this IConfiguration, there is now no JSON converter involved, so if I want to handle polymorphic lists I have to implement a seperate solution here, and it seems like there isn't a way to take control of binding yet.

Originally posted by @dazinator in #56297 (comment)

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Text.Json untriaged New issue has not been triaged by the area owner labels Jul 26, 2021
@ghost
Copy link

ghost commented Jul 26, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Side note related to same problem in different area of the stack: Even if this solves the problem for System.Text.Json, I have the same problem for Microsoft.Extensions.Options when binding an options class with a polymorphic list, to an IConfiguration section. In this case the a json file is first read by ConfigurationBuilder.AddJsonFile("appsettings.json") and ends up as essentially key value pairs. The descriminator property is now a key value pair in the IConfiguration. When materialising IOptions from this IConfiguration, there is now no JSON converter involved, so if I want to handle polymorphic lists I have to implement a seperate solution here, and it seems like there isn't a way to take control of binding yet.

Originally posted by @dazinator in #56297 (comment)

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json, untriaged

Milestone: -

@eiriktsarpalis eiriktsarpalis changed the title Side note related to same problem in different area of the stack: Even if this solves the problem for System.Text.Json, I have the same problem for Microsoft.Extensions.Options when binding an options class with a polymorphic list, to an IConfiguration section. In this case the a json file is first read by ConfigurationBuilder.AddJsonFile("appsettings.json") and ends up as essentially key value pairs. The descriminator property is now a key value pair in the IConfiguration. When materialising IOptions from this IConfiguration, there is now no JSON converter involved, so if I want to handle polymorphic lists I have to implement a seperate solution here, and it seems like there isn't a way to take control of binding yet. IConfiguration append additional property Jul 26, 2021
@ghost
Copy link

ghost commented Jul 26, 2021

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Side note related to same problem in different area of the stack: Even if this solves the problem for System.Text.Json, I have the same problem for Microsoft.Extensions.Options when binding an options class with a polymorphic list, to an IConfiguration section. In this case the a json file is first read by ConfigurationBuilder.AddJsonFile("appsettings.json") and ends up as essentially key value pairs. The descriminator property is now a key value pair in the IConfiguration. When materialising IOptions from this IConfiguration, there is now no JSON converter involved, so if I want to handle polymorphic lists I have to implement a seperate solution here, and it seems like there isn't a way to take control of binding yet.

Originally posted by @dazinator in #56297 (comment)

Author: eiriktsarpalis
Assignees: -
Labels:

area-Extensions-Options, untriaged

Milestone: -

@eiriktsarpalis
Copy link
Member Author

@dazinator I've forked your comment into a separate issue for easier review.

@eiriktsarpalis
Copy link
Member Author

Looks like you've already filed a second issue in #56302. Closing in favor of that one.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Options untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant