Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

Add support for binding property to IConfiguration #60

Closed

Description

@davidfowl

In omnisharp I want to have a configuration like this:

{
   "msbuild": {
      "toolsVersion": "14.0",
       "properties": {
           "RandomProperty": "1",
           "VisualStudioVersion": "14.0"
        }
   }
}

I would like to express my options like so:

public class MSBuildOptions
{
     public string ToolsVersion { get; set; }
     public IConfiguration Properties { get; set; }
}

That way I would be able to express both the latebound and strongly typed properties on the same model object.

/cc @glennc @muratg @Eilon @lodejard

Activity

  1. added this to the 1.0.0-beta5 milestone on Apr 30, 2015
  2. Eilon commented on May 1, 2015

    @Eilon
    Contributor

    This is like a combination of model binding and tag helpers 😄

    We do support binding to dictionaries now with @victorhurdugaci 's change, no? Would that work here?

  3. davidfowl commented on May 1, 2015

    @davidfowl
    MemberAuthor

    If I have a complex structure this gives me more flexibility

  4. Eilon commented on May 1, 2015

    @Eilon
    Contributor

    True, but in the specific case you gave I think it's supported quite well. So, backlog?

  5. davidfowl commented on May 1, 2015

    @davidfowl
    MemberAuthor

    Sure

  6. davidfowl commented on May 1, 2015

    @davidfowl
    MemberAuthor

    Would it be Dictionary<string, string>?

  7. victorhurdugaci commented on May 1, 2015

    @victorhurdugaci
    Contributor

    If you have only one level of nesting like in your example, Dictionary<string, string> will work. If you have multiple levels (e.g. VisualStudioVersion being a complex object), we don't support it that today and you have to use IConfiguration.

  8. Eilon commented on May 1, 2015

    @Eilon
    Contributor

    I think it does all kinds of conversions for you... https://github.com/aspnet/Options/blob/dev/test/Microsoft.Framework.OptionsModel.Test/ConfigurationCollectionBindingTests.cs

    It definitely seems to support Dictionary<string, string> though I'm not sure if TValue can be a simple type such as int, though I do see it can also be a complex type.

  9. victorhurdugaci commented on May 1, 2015

    @victorhurdugaci
    Contributor

    Dictionary<string, T> is supported as long as all Ts are the same type. T can be int.

  10. Eilon commented on May 1, 2015

    @Eilon
    Contributor

    Ah don't think I saw a test for that... did I miss it? If it's not there, can we quickly add one?

  11. victorhurdugaci commented on May 1, 2015

    @victorhurdugaci
    Contributor

    Sure, I can add one tomorrow

  12. victorhurdugaci commented on May 6, 2015

    @victorhurdugaci
    Contributor

    So, is this backlog or not?

  13. Eilon commented on May 7, 2015

    @Eilon
    Contributor

    @davidfowl how passionate are you about this? For me this seems like super backlog. We can bring this back at any time.

  14. removed this from the 1.0.0-beta5 milestone on May 21, 2015
  15. HaoK commented on Sep 30, 2015

    @HaoK
    Member

    Config binder has moved to config and there's a similar bug here: aspnet/Configuration#274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions