开发者

external configuration file for enterprise library

开发者 https://www.devze.com 2022-12-16 14:13 出处:网络
If i use an external configuration file for Microsoft enterprise library for my program,then all the configuration for enterprise library must reside in the external configuration file? can i still ha

If i use an external configuration file for Microsoft enterprise library for my program, then all the configuration for enterprise library must reside in the external configuration file? can i still have part of the configuration in the host开发者_开发百科ing configuration file?


If I understand you correctly you want to configure Entlib in an external file, and override some settings on your app.config?

If that's the case, check the EntLib Hands-On Labs. Particularly take a look at the configuration HOL; it shows you how to inherit configuration from a shared location, and override it.


I am using Enterprise Library 5.0

I needed to reference my enterprise library config outside the app.config.

I used the following with my own logging factory:

var configSource = new FileConfigurationSource("EntiLib.config");
var logWriterFactory = new LogWriterFactory(configSource);
var logWriter = logWriterFactory.Create();

I was able to find this solution on CodePlex answer on code plex


Good links by Nicolas and Peter. Glad you found the hands-on labs useful. In addition, please take a look at this chapter that we wrote to explain various configuration scenarios, including:

  • reading configuration information from a wide range of sources.
  • enforcing common configuration settings across multiple applications.
  • sharing configuration settings between applications.
  • specifying a core set of configuration settings that applications can inherit.
  • merging configuration settings that are stored in a shared location.
  • creating different configurations for different deployment environments.
0

精彩评论

暂无评论...
验证码 换一张
取 消