Westwind.ApplicationConfiguration
Westwind.ApplicationConfiguration copied to clipboard
JsonFileConfigurationProvider Doesn't Save Multiple ConfigurationSections
When working with multiple configuration classes that have different ConfigurationSection names and save to the same JSON file, ConfigurationSection does not work. Instead, only the most recent object Write is saved to the file.
Example (all saving to Settings.json"): colors.Write() // Has ConfigurationSection defined as "Colors" under OnCreateDefaultProvider users.Write() // Has ConfigurationSection defined as "Users" under OnCreateDefaultProvider
Only users are saved, and without any ConfigurationSection too.
Using another provider seems to work fine.
Sorry for not responding sooner.
Not sure I understand. The JSON provider works with individual files for each configuration you create. JSON and XML configuration doesn't have a concept of sections. You just create your objects and they are persisted to disk as files using standard serialization.