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

StringDictionary is not supported by Microsoft.Extensions.Configuration.Binder.ConfigurationBinder #46725

Open
Kaelum opened this issue Jan 6, 2021 · 5 comments

Comments

@Kaelum
Copy link

Kaelum commented Jan 6, 2021

The StringDictionary class is a prefect representation of a Dictionary that is represented by an IConfiguration interface, as the keys are case insensitive in both objects.

I propose that either of the following options be implemented:

  1. The StringDictionary class implements the IDictionary<string, string> interface.
  2. The Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance() method adds support for StringDictionary.

This would make it much simpler, and cleaner, when using IConfiguration.

Additionally, there is a fatal flaw in the current design as Microsoft.Extensions.Configuration.ConfigurationBinder.CreateInstance() does not create a case insensitive dictionary, thus lookups for keys that vary only in case, fail.

@mairaw mairaw transferred this issue from dotnet/core Jan 8, 2021
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Extensions-Configuration untriaged New issue has not been triaged by the area owner labels Jan 8, 2021
@ghost
Copy link

ghost commented Jan 8, 2021

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

Issue Details

The StringDictionary class is a prefect representation of a Dictionary that is represented by an IConfiguration interface, as the keys are case insensitive in both objects.

I propose that either of the following options be implemented:

  1. The StringDictionary class implements the IDictionary<string, string> interface.
  2. The Microsoft.Extensions.Configuration.ConfigurationBinder.BindInstance() method adds support for StringDictionary.

This would make it much simpler, and cleaner, when using IConfiguration.

Additionally, there is a fatal flaw in the current design as Microsoft.Extensions.Configuration.ConfigurationBinder.CreateInstance() does not create a case insensitive dictionary, thus lookups for keys that vary only in case, fail.

Author: Kaelum
Assignees: -
Labels:

area-Extensions-Configuration, untriaged

Milestone: -

@iSazonov
Copy link
Contributor

StringDictionary will be marked as obsolete #889

@Kaelum
Copy link
Author

Kaelum commented Jan 10, 2021

@iSazonov I responded in the other thread, but you are aware that this, and several other of these specialized classes, are heavily used by ASP.NET, correct? This class alone is used as the basis for the entire configuration system.

@iSazonov
Copy link
Contributor

@Kaelum This can be actively used, but it does not reject the possibility of an new alternative based on generic Dictionary.

@davidfowl
Copy link
Member

ASP.NET Core doesn't use any of the specialized collections

@maryamariyan maryamariyan removed the untriaged New issue has not been triaged by the area owner label Mar 11, 2021
@maryamariyan maryamariyan added this to the Future milestone Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants