public EnvironmentConfig GetEnvironmentConfiguration(string environmentName)
 {
     try
     {
         EnvironmentConfig env;
         if (environmentCache.TryGetValue(environmentName, out env))
         {
             return(env);
         }
         if (ConfigSet.IsNull())
         {
             LoadConfigSet();
         }
         var envs = from e in ConfigSet.Environments where e.EnvironmentName == environmentName select e;
         env = envs.First();
         environmentCache.TryAdd(environmentName, env);
         return(env);
     }
     catch (Exception ex)
     {
         if (LastException != null)
         {
             LastException.Log();
         }
         throw new InvalidDataException(string.Format("Cannot find environment node with name = {0}", environmentName), LastException ?? ex);
     }
 }
 public ConfigParameter GetComplexConfigurationParameters(string rootName)
 {
     try
     {
         var cp = from c in ConfigSet.Parameters where c.Name == rootName select c;
         return(cp.First());
     }
     catch (Exception ex)
     {
         if (LastException != null)
         {
             LastException.Log();
         }
         throw new InvalidDataException(string.Format("Cannot find Parameters node with name {0}", rootName), LastException ?? ex);
     }
 }
 public ServiceConfig GetServiceConfiguration(string serviceName)
 {
     try
     {
         ServiceConfig service;
         if (serviceCache.TryGetValue(serviceName, out service))
         {
             return(service);
         }
         var services = from s in ConfigSet.Services where s.ServiceName == serviceName select s;
         service = services.First();
         serviceCache.TryAdd(serviceName, service);
         return(service);
     }
     catch (Exception ex)
     {
         if (LastException != null)
         {
             LastException.Log();
         }
         throw new InvalidDataException(string.Format("Cannot find service node with name = {0}", serviceName), LastException ?? ex);
     }
 }