private static void ProcessConfig(string config) { var name = config.Split('-')[1]; var configs = new HttpConfigBLL().GetAll(); var isProduct = configs.FirstOrDefault(r => r.Name == "IsProduct"); var entity = configs.FirstOrDefault(r => r.Name != "IsProduct"); if (entity != null) { if (isProduct != null) { httpConfigs.AddOrUpdate(entity.Name, entity.ProdcutValue, (key, existingVal) => { if (existingVal != entity.ProdcutValue) { return(entity.ProdcutValue); } else { return(existingVal); } }); } else { httpConfigs.AddOrUpdate(entity.Name, entity.TestValue, (key, existingVal) => { if (existingVal != entity.TestValue) { return(entity.TestValue); } else { return(existingVal); } }); } } else { throw new Exception("httpconfig配置不存在"); } }
private static void ProcessConfig() { time = DateTime.Now; var configs = new HttpConfigBLL().GetAll(); var isProduct = configs.FirstOrDefault(r => r.Name == "IsProduct"); var entitys = configs.Where(r => r.Name != "IsProduct").ToList(); foreach (var entity in entitys) { if (isProduct != null) { httpConfigs.AddOrUpdate(entity.Name, entity.ProdcutValue, (key, existingVal) => { if (existingVal != entity.ProdcutValue) { return(entity.ProdcutValue); } else { return(existingVal); } }); } else { httpConfigs.AddOrUpdate(entity.Name, entity.TestValue, (key, existingVal) => { if (existingVal != entity.TestValue) { return(entity.TestValue); } else { return(existingVal); } }); } } }