Open paul-barton opened 6 years ago
Config.Net does not find aliases when used on collections.
Should be able to reproduce by using following interfaces:
interface ICredentials { [Option(Alias = "uname")] string Username { get; } [Option(Alias = "pw")] string Password { get; } } interface IMyConfig { [Option(Alias = "creds")] IEnumerable<ICredentials> AllCredentials { get; } }
and using json store:
IMyConfig config= new ConfigurationBuilder<IMyConfig>() .UseJsonFile(jsonPath) .Build();
and json:
{ "creds": [ { "uname": "janedoe", "pw": "1234" }, { "uname": "johndoe", "pw": "5678" } ] }
Above is a simple example of my config but should reproduce the issue I believe. If not I can update a more specific example. Workaround is just to not use the alias on the collection and just use the camel case method name for the collection.
{ "AllCredentials": [ { "uname": "janedoe", "pw": "1234" }, { "uname": "johndoe", "pw": "5678" } ] }
@aloneguid I can confirm this issue and it drove me crazy. Could you please look into it?
thanks @martin-braun looking into this
Config.Net does not find aliases when used on collections.
Should be able to reproduce by using following interfaces:
and using json store:
and json:
Above is a simple example of my config but should reproduce the issue I believe. If not I can update a more specific example. Workaround is just to not use the alias on the collection and just use the camel case method name for the collection.