Beispiel #1
0
 public SiteCatalogContentEventListener(ReferenceConverter referenceConverter,
                                        IContentRepository contentRepository, IClient client,
                                        CatalogEventIndexer indexer,
                                        CatalogContentClientConventions catalogContentClientConventions,
                                        PriceIndexing priceIndexing,
                                        IRelationRepository relationRepository)
     : base(referenceConverter, contentRepository, client, indexer, catalogContentClientConventions, priceIndexing)
 {
     _referenceConverter = referenceConverter;
     _contentRepository  = contentRepository;
     _relationRepository = relationRepository;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes this instance.
        ///
        /// </summary>
        /// <param name="context">The context.</param>
        /// <remarks>
        /// Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called
        ///             only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization
        ///             method will be called repeadetly for each request reaching the site until the method succeeds.
        ///
        /// </remarks>
        public void Initialize(InitializationEngine context)
        {
            CatalogContentClientConventions instance = context.Locate.Advanced.GetInstance <B2BCatalogContentClientConventions>();

            try
            {
                instance.ApplyConventions(SearchClient.Instance.Conventions);
            }
            catch (Exception ex)
            {
                if (Log.IsErrorEnabled())
                {
                    Log.Error("Could not apply catalog content conventions.", ex);
                }
            }
            _broadcaster = context.Locate.Advanced.GetInstance <CatalogKeyEventBroadcaster>();
            _listener    = context.Locate.Advanced.GetInstance <CatalogContentEventListener>();
            _listener.AddEvent();
            _broadcaster.InventoryUpdated += _listener.InventoryUpdated;
            _broadcaster.PriceUpdated     += _listener.PriceUpdated;
        }