App.Config.... Config
Is there a place in the external config files in which I can store appSettings?
I'd like to not store them in the web.config knowing it gets wiped on every upgrade (and backed up, but that's another step a user would have to remember)
Hi Steve,
Alternatively, you could implement your custom configuration settings, e.g.:
public
class
AppSettingsConfig : ConfigSection
[ConfigurationProperty(
"backendTheme"
, DefaultValue =
"Default"
, IsRequired =
false
)]
public
string
BackendTheme
get
return
(
string
)
this
[
"backendTheme"
];
set
this
[
"backendTheme"
] = value;
Once you register it with:
Config.RegisterSection(
typeof
(AppSettingsConfig));
You can access it in your code with:
Config.Get<AppSettingsConfig>().BackendTheme;
Oh neat!
So does that generate the xml in App_Data or is it just saved to the DB?
Can it be implemented inside a control library to create it if it doesn't exist, then query on it?...or still the user would have to register it once.
Hello Steve,
Configurations are XML data storage. There you can persist data you want. This is just another way to persist your data. You can check this article.
You can register configuration types either in the Global.asax file in the application start event or if you are developing a module, you can register them in the Initialize method of your module class.
Then you can access the configurations from any control you have.
Kind regards,
Ivan Dimitrov
the Telerik team