Load parts of App.Config from another file

后端 未结 1 1732
死守一世寂寞
死守一世寂寞 2020-12-15 09:47

I like to split my app.config into a user specific part and an application specific part. Is it possible to store a part of the app.config in anoth

1条回答
  •  既然无缘
    2020-12-15 10:12

    You can use the configSource attribute to tell the framework to load a particular section from another file.

    For example, if you had a config file with a section like this:

    
        
    
    

    You could replace it with:

      
    

    ...and create a file ConnectionStrings.config with the contents of the original section (including the node - exactly the same as my first code section above).

    0 讨论(0)
提交回复
热议问题