예제 #1
0
 public void AddIfNotExist(string key, Toc toc)
 {
     if (!_values.TryAdd(key, toc))
     {
         _logger.Information("Duplicate Toc {key} new value not set {@toc}.", key, toc);
     }
 }
예제 #2
0
 public void AddOrReplace(string key, Toc toc)
 {
     if (!_values.TryAdd(key, toc))
     {
         _values[key] = toc;
         _logger.Information("Replace Toc {key}.", key);
     }
 }
예제 #3
0
        public Toc FindOrAdd(string key)
        {
            if (!_values.TryGetValue(key, out var value))
            {
                _logger.Information("{key} Toc not found. Creating.", key);
                var newValue = new Toc(key);
                value = _values.GetOrAdd(key, newValue);
            }

            return(value);
        }
예제 #4
0
 public bool Equals(Toc other)
 {
     return(Code == other.Code);
 }
예제 #5
0
 public bool IsValid(Toc toc) => NoFilter || Tocs.Contains(toc.Code);