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

HostBuilder.Properties and HostBuilderContext.Properties should be dictionaries not arrays #1470

Open
CoryCharlton opened this issue Apr 16, 2024 · 5 comments

Comments

@CoryCharlton
Copy link
Member

Library/API/IoT binding

nanoFramework.Hosting

Visual Studio version

No response

.NET nanoFramework extension version

No response

Target name(s)

No response

Firmware version

No response

Device capabilities

No response

Description

HostBuilder.Properties and HostBuilderContext.Properties are currently arrays. This makes them challenging to work with as the values need to be set at a single time and the order of the items must be known.

.NET full implements these as dictionaries which makes more sense (https://github.com/dotnet/runtime/blob/69280cd085ca65e8cecee4d94888784f37271386/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs#L52).

How to reproduce

No response

Expected behaviour

No response

Screenshots

No response

Sample project or code

No response

Aditional information

No response

@CoryCharlton
Copy link
Member Author

I'm happy to make this change. I also think we should change the namespace to Microsoft.Extensions.Hosting to match .NET full.

@josesimoes
Copy link
Member

Pinging @bytewizer to ask if there was a design motivation to use Arrays instead of dictionaries.

@josesimoes
Copy link
Member

IIRC the namespace being under nanoframework name means that we are deviating from the .NET API... 🤔

@CoryCharlton
Copy link
Member Author

IIRC the namespace being under nanoframework name means that we are deviating from the .NET API... 🤔

Sure that makes sense in cases where we are deviating but this doesn't appear to be one as it's pretty similar.

We made a namespace change in this PR for nanoFramework.DependencyInjection which is part of my motivation for suggesting we do the same here.

@josesimoes
Copy link
Member

Another attempt to get feedback from @bytewizer about this... 😉

@CoryCharlton if there is no feedback (as I don't see any issues with these changes) please go ahead.

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

2 participants