Add support for Guid Dictionary keys in IOptions binding.

Open
#116,648 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
backend

Research direction

Start in src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs at the linked key-type handling around lines 617-634. Compare the existing integer, string, and enum cases, then determine the scope needed for Guid dictionary keys; done means options binding accepts dictionaries keyed by Guid.

Written by the indexing model from the issue text.

Description

area-Extensions-Configuration

The current options binding implementation only supports the following Dictionary key types:

  • integers
  • strings
  • enums

https://github.com/dotnet/runtime/blob/3875b54e7b10b10606b105340199946d0b877754/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs#L617-L634

While #36540 would greatly enhance usability by adding extensibility for custom string->key conversions, adding direct support for Guid keys in in the interim would be enormously valuable.

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.