开发者

using Environment variables to set enterpriseLibrary filepath

I want to set the enterprise library(3.1) path to use Environment variables something like

<add name="ExternalEntLibConfig" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b0开发者_JS百科3f5f7f11d50a3a"
           filePath="%CONFIG_PATH%\SharedEntLib.Config"/>

I can use expandvariables to substitute %CONFIG_PATH%

SpecialFolder.ExpandVariables(@"%CONFIG_PATH%");

My questions are:

  1. Is there any "magic" character that I'm missing that will substitute %CONFIG_PATH% with the actual value?
  2. Is there any method i need to override while the Enterprise library get load?

Thanks,Pini.


The bad news is that I don't think there is any magic way to make the substitution happen (correct me if I'm wrong, folks!).

The good news is that you can create your own FileConfigurationSource that does what you want. You should be able to extend FileConfigurationSource and implement some version of Environment.ExpandEnvironmentVariables() in your code before calling the base class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜