public IEnumerable <CatalogEntryDto.CatalogEntryRow> GetCatalogEntries()
        {
            // The chunk size has to be so small because there is a bug in Mediachase.Commerce.Catalog.Dto.CatalogEntryDto.GetPriceValues()
            // where the entry is located in a list of prices. The list and the chunk are the same size, so if it's too large then a
            // lot of comparisons are made. A fix would be to change that list to a dictionary. This has been reported to EPiServer.
            const int batchSize = 100;

            for (var i = 1; i <= Count; i += batchSize)
            {
                foreach (var entry in _catalogSystemMapper.ContinueFindItemsForIndexing(_searchSetId, i, batchSize))
                {
                    yield return(entry);
                }
            }
        }
Пример #2
0
        internal IncrementalCatalogEntryProvider(int catalogId, ESalesVariantHelper eSalesVariantHelper, ICatalogSystemMapper catalogSystemMapper,
                                                 IIndexSystemMapper indexSystemMapper)
        {
            _eSalesVariantHelper = eSalesVariantHelper;
            _catalogSystemMapper = catalogSystemMapper;

            var searchSetId = Guid.NewGuid();

            _catalogSystemMapper.StartFindItemsForIndexing(searchSetId, catalogId, true, indexSystemMapper.LastBuildDate.ToUniversalTime(),
                                                           indexSystemMapper.CurrentBuildDate);
            var entryTable      = _catalogSystemMapper.ContinueFindItemsForIndexing(searchSetId, 1, int.MaxValue - 1);
            var originalEntries = entryTable.Rows.Cast <CatalogEntryDto.CatalogEntryRow>().ToDictionary(e => e.CatalogEntryId, e => e);

            _allEntries = AppendMissingVariants(originalEntries).ToArray();
        }