Esempio n. 1
0
        private static void DeleteProductVariantFromIndex(IProductVariant productVariant)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(productVariant.ProductKey);
            ProductIndexer.DeleteFromIndex(((ProductVariant)productVariant).ExamineId.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 2
0
        /// <summary>
        /// Removes a product with all of its variants from the index
        /// </summary>
        static void ProductServiceDeleted(IProductService sender, DeleteEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            e.DeletedEntities.ForEach(DeleteProductFromIndex);
        }
Esempio n. 3
0
        private static void IndexProductVariant(IProductVariant productVariant)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(productVariant.ProductKey);
            ProductIndexer.ReIndexNode(productVariant.SerializeToXml().Root, IndexTypes.ProductVariant);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds or updates a product with all of its variants to the index
        /// </summary>
        static void ProductServiceSaved(IProductService sender, SaveEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            e.SavedEntities.ForEach(IndexProduct);
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CachedProductQuery"/> class.
 /// </summary>
 /// <param name="merchelloContext">
 /// The <see cref="IMerchelloContext"/>.
 /// </param>
 /// <param name="indexProvider">
 /// The index provider.
 /// </param>
 /// <param name="searchProvider">
 /// The search provider.
 /// </param>
 /// <param name="enableDataModifiers">
 /// The enable data modifiers.
 /// </param>
 /// <param name="conversionType">
 /// The is for back office editors.
 /// </param>
 internal CachedProductQuery(IMerchelloContext merchelloContext, BaseIndexProvider indexProvider, BaseSearchProvider searchProvider, bool enableDataModifiers, DetachedValuesConversionType conversionType)
     : base(merchelloContext.Cache, merchelloContext.Services.ProductService, indexProvider, searchProvider, enableDataModifiers)
 {
     _productService        = (ProductService)merchelloContext.Services.ProductService;
     this._conversionType   = conversionType;
     _productContentFactory = new Lazy <ProductContentFactory>(() => new ProductContentFactory());
     _cache = new VirtualProductContentCache(merchelloContext.Cache, this.GetProductContent, enableDataModifiers);
     this.Initialize();
 }
Esempio n. 6
0
        /// <summary>
        /// Removes a product with all of its variants from the index
        /// </summary>
        static void ProductServiceDeleted(IProductService sender, DeleteEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            foreach (var eDeletedEntity in e.DeletedEntities)
            {
                DeleteProductFromIndex(eDeletedEntity);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Adds or updates a product with all of its variants to the index
        /// </summary>
        static void ProductServiceSaved(IProductService sender, SaveEventArgs <IProduct> e)
        {
            var cache = new VirtualProductContentCache();

            cache.ClearVirtualCache(e);
            foreach (var eSavedEntity in e.SavedEntities)
            {
                IndexProduct(eSavedEntity);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// The product option repository re index.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The product keys.
        /// </param>
        /// <remarks>
        /// REFACTOR v3
        /// </remarks>
        private void ProductOptionRepositoryReIndex(ProductOptionRepository sender, Core.Events.ObjectEventArgs <IEnumerable <Guid> > e)
        {
            var keys = e.EventObject;

            if (MerchelloContext.HasCurrent)
            {
                var products     = MerchelloContext.Current.Services.ProductService.GetByKeys(keys).ToArray();
                var contentCache = new VirtualProductContentCache();
                foreach (var p in products)
                {
                    IndexProduct(p);

                    // we also need to refresh the published product cache
                    contentCache.ClearVirtualCache(p);
                }
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Adds or updates a product with all of its variants to the index
 /// </summary>        
 static void ProductServiceSaved(IProductService sender, SaveEventArgs<IProduct> e)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(e);
     e.SavedEntities.ForEach(IndexProduct);
 }
Esempio n. 10
0
 /// <summary>
 /// Removes a product with all of its variants from the index
 /// </summary>   
 static void ProductServiceDeleted(IProductService sender, DeleteEventArgs<IProduct> e)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(e);
     e.DeletedEntities.ForEach(DeleteProductFromIndex);
 }
Esempio n. 11
0
 private static void IndexProductVariant(IProductVariant productVariant)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(productVariant.ProductKey);
     ProductIndexer.ReIndexNode(productVariant.SerializeToXml().Root, IndexTypes.ProductVariant);
 }
Esempio n. 12
0
 private static void DeleteProductVariantFromIndex(IProductVariant productVariant)
 {
     var cache = new VirtualProductContentCache();
     cache.ClearVirtualCache(productVariant.ProductKey);
     ProductIndexer.DeleteFromIndex(((ProductVariant)productVariant).ExamineId.ToString(CultureInfo.InvariantCulture));
 }