App.Config.... Config

Posted by Community Admin on 05-Aug-2018 07:00

App.Config.... Config

All Replies

Posted by Community Admin on 18-Jan-2011 00:00

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)

Posted by Community Admin on 18-Jan-2011 00:00

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;


In this case you can modify the configuration through Sitefinity UI.

Otherwise, we have plans to implement merging of the web.configs when upgrading. Hopefully, this will be addressed in the service pack.

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Posted by Community Admin on 18-Jan-2011 00:00

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.

Posted by Community Admin on 18-Jan-2011 00:00

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


Check out Telerik Trainer, the state of the art learning tool for Telerik products.

This thread is closed