private void OnAssociationUpdated(object sender, AssociationEventArgs e) { Logger.Debug("OnAssociationUpdated raised."); ICollection <ProductContent> products = GetProductsAffected(e); // HACK: Episerver does not clear the deleted associations from cache until after this event has completed. // In order to load the list of associations after deletions/updates, force delete the association list from cache. foreach (ProductContent entry in products) { _cache.Remove("EP:ECF:Ass:" + entry.ContentLink.ID); } _productExportService.ExportProductRecommendations(products, null); }
private ICollection <ProductContent> GetProductsAffected(AssociationEventArgs e) { ICollection <ContentReference> entryLinks = new HashSet <ContentReference>(ContentReferenceComparer.Default); foreach (AssociationChange change in e.Changes) { entryLinks.Add( _referenceConverter.GetContentLink(change.ParentEntryId, CatalogContentType.CatalogEntry, 0)); } ICollection <ProductContent> entries = _contentLoader .GetItems(entryLinks, CultureInfo.InvariantCulture) .OfType <ProductContent>() .ToArray(); return(entries); }
public void AssociationUpdated(object source, AssociationEventArgs args) { }