If you want to change your settings based on properties of your ViewModel
, your approach would work. The only problem is that your ViewModel
is tightly coupled with System.Configuration.ApplicationSettingsBase
class.
I would create a Wrapper class that implements an interface (say IConfigProvider) that exposes all your settings as Properties and the Save method and inject that into your ViewModel
. This way, you can pass a mock\stub when you unit test your ViewModel
.
Another benefit is that if you ever decide to change the way you store your config values (say you want to store some settings in the database), you don't need to touch your ViewModels
as all that job is done in your ConfigProvider
class.