private static EntryConverter Build(ICatalogSystemMapper catalogSystem)
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <EntryConverter>();
            builder.Register(c => catalogSystem);
            builder.Register(c => new Mock <IMetaDataMapper>().Object);
            builder.Register(c => new Mock <IPriceServiceMapper>().Object);
            builder.Register(c => new Mock <IConfiguration>().Object);
            builder.Register(c => new Mock <IUrlResolver>().Object);

            var keyLookup = new Mock <IKeyLookup>();

            keyLookup
            .Setup(kl => kl.Value(It.IsAny <CatalogEntryDto.CatalogEntryRow>(), It.IsAny <string>()))
            .Returns <CatalogEntryDto.CatalogEntryRow, string>((e, l) => AttributeHelper.CreateKey(e.Code, l));
            builder.Register(c => keyLookup.Object);

            builder.Register(c => new PromotionEntryCodeProvider(c.Resolve <PromotionDataTableMapper>(), Enumerable.Empty <IPromotionEntryCodes>()));
            builder.Register(c => new PromotionDataTableMapper(
                                 new PromotionDto.PromotionLanguageDataTable(),
                                 new PromotionDto.PromotionDataTable(),
                                 new CampaignDto.CampaignDataTable()));

            builder.RegisterAssemblyTypes(typeof(IFormatRule).Assembly).As <IFormatRule>();
            builder.RegisterType <Formatter>();

            var container = builder.Build();

            return(container.Resolve <EntryConverter>());
        }
 public ProductIndexBuilder(
     IAppConfig appConfig, ICatalogSystemMapper catalogSystem, IIndexSystemMapper indexSystem, IKeyLookup keyLookup,
     EntryConverter entryConverter, IOperationsWriter writer, IEnumerable <IProductsAppender> appenderPlugins, IProductConverter converterPlugin = null)
 {
     _appConfig       = appConfig;
     _catalogSystem   = catalogSystem;
     _indexSystem     = indexSystem;
     _keyLookup       = keyLookup;
     _entryConverter  = entryConverter;
     _writer          = writer;
     _converterPlugin = converterPlugin;
     _appenderPlugins = appenderPlugins.ToArray();
 }
예제 #3
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();
        }
예제 #4
0
 public EntryConverter(ICatalogSystemMapper catalogSystem, IMetaDataMapper metaData, IPriceServiceMapper priceService, IKeyLookup keyLookup,
                       PromotionEntryCodeProvider promotionProvider, IConfiguration configuration, IUrlResolver urlResolver, Formatter formatter)
 {
     _catalogSystem         = catalogSystem;
     _metaData              = metaData;
     _priceService          = priceService;
     _keyLookup             = keyLookup;
     _promotionProvider     = promotionProvider;
     _configuration         = configuration;
     _urlResolver           = urlResolver;
     _formatter             = formatter;
     _standardAttributes    = new HashSet <string>(new[] { "locale" });
     _confProductAttributes = _configuration.ProductAttributes.ToDictionary(pa => pa.Name);
     _confFacetAttributes   = _configuration.FacetAttributes.ToDictionary(fa => fa.Name);
 }
        public static ICatalogEntryProvider Create(bool incremental, int catalogId, ESalesVariantHelper eSalesVariantHelper, ICatalogSystemMapper catalogSystemMapper,
                                                   IIndexSystemMapper indexSystemMapper)

        {
            if (incremental)
            {
                return(new IncrementalCatalogEntryProvider(catalogId, eSalesVariantHelper, catalogSystemMapper, indexSystemMapper));
            }
            return(new FullCatalogEntryProvider(catalogId, catalogSystemMapper));
        }
 internal FullCatalogEntryProvider(int catalogId, ICatalogSystemMapper catalogSystemMapper)
 {
     _catalogSystemMapper = catalogSystemMapper;
     _searchSetId         = Guid.NewGuid();
     Count = _catalogSystemMapper.StartFindItemsForIndexing(_searchSetId, catalogId, false, null, null);
 }
 public BuySKUFromCategoryXGetDiscountedShippingEntryCodes(ICatalogSystemMapper catalogSystemMapper)
 {
     _catalogSystemMapper = catalogSystemMapper;
 }