aloneguid / config

⚙ Config.Net - the easiest configuration framework for .NET developers. No BS.
MIT License
641 stars 85 forks source link

Incorrect collection values if using multiple json files #105

Closed feitzi closed 3 years ago

feitzi commented 4 years ago

If you use multiple json stores and you read a dictionary you get just the values from the last configured store. This is a problem if you dont't have configured the collection in this store.

Some example:

      private const string configBasic = @"{
'KeyA': 'basic',
'KeyB': 'basic',
'Creds': [
      {
         'Username': 'user',
         'Password': 'debug'
   }
]
}";

      private const string configOverride = @"{
'KeyB': 'override',
}";

         var configurationBuilder = new ConfigurationBuilder<IRootElement>();
         configurationBuilder
            .UseJsonString(configOverride)
            .UseJsonString(configBasic);
         ConfigInterface = configurationBuilder.Build();

With that configuration, the values for Creds shout contain the value user. But it is an empty collection. The example just works if you declare the Creds collection in the json file configOverride!