Moving Settings to another config file

后端 未结 5 1508
终归单人心
终归单人心 2020-12-15 09:51

Is it possible to move applicationSettings to another config file as it is possible with connectionStrings or appSettings?

When I create Settings for my web applica

5条回答
  •  轮回少年
    2020-12-15 10:39

    Yes of course it's possible! Any ConfigurationSection in any of your config files can be "externalized" by means of the configSource="otherConfigFile.config" attribute.

    It would be even better if I could force Settings class to use appSettings not applicationSettings.

    In order to do that, you need to get away from using the nice visual "Settings" classes in .NET and use the ConfigurationManager directly. That way, you can put your settings into and read them in using ConfigurationManager.AppSettings["keyname"].

    Marc

提交回复
热议问题