public SqlMapConfig GetConfigForMapFile(string mapfileName) { var configs = _sqlMapConfigs.Where(e => e.Value.Maps.Select(x => x.Value).Contains(mapfileName)).Select(e => e.Value); if (configs.Count() == 1) { return(configs.First()); } if (configs.Count() == 0) { return(new SqlMapConfig()); } if (configs.Count() > 1 && configs.All(e => configs.First().Equals(e))) { return(configs.First()); } throw new Exception($"Map {mapfileName} is found in more than 1 non distinct configs."); }