예제 #1
0
 public CustomComparatorSource(string sorterName, string databaseName, IndexQueryServerSide query)
 {
     _query   = query;
     _factory = SorterCompilationCache.Instance.GetItemType(sorterName, databaseName);
     if (_factory == null)
     {
         SorterDoesNotExistException.ThrowFor(sorterName);
     }
 }
예제 #2
0
        public static CreateSorter GetSorter(string name, string databaseName)
        {
            var key = new CacheKey(databaseName, name, null);

            if (SortersPerDatabaseCache.TryGetValue(key, out var result) == false)
            {
                SorterDoesNotExistException.ThrowFor(name);
            }

            try
            {
                return(result.Value);
            }
            catch (Exception)
            {
                SortersPerDatabaseCache.TryRemove(key, out _);
                throw;
            }
        }