Path -> Base: /dome[@domain=$Hostname]
is really the only way to pass the $hostname into this is by the default value???
I have written a piece of code here to do it by module level...but I need a global setting for the repository.
Code: Select all
public static void setCommonRepositoryHostname()
{
string globalParamOverridePath = "C:\\Users\\Public\\workspace\\Resource\\global-parameters-override.csv";
var GlobalParamOverrideCsv = new FileInfo(globalParamOverridePath);
string path = "C:\\Users\\Public\\workspace\\Resource\\global-parameters.csv";
if (GlobalParamOverrideCsv.Exists)
path= globalParamOverridePath;
IEnumerable<string> linesEnumerable = File.ReadLines(path);
string [] lines = linesEnumerable.ToArray();
string [] columns = lines[0].Split(',');
int hostnameColumnIndex = 0;
for(int i = 0; i < columns.Length; ++i)
{
if(columns[i].Trim().ToLower().Equals("hostname"))
hostnameColumnIndex = i;
}
string domain = lines[1].Split(',')[hostnameColumnIndex].Trim();
Common.CommonRepository repo = Common.CommonRepository.Instance;
repo.Hostname = domain;
}