private static void Dynamic_Content_Deleteing_Action(IDynamicContentDeletingEvent updatedEventInfo) { var autofacLifetimeScope = AutofacDependencyResolver.Current.RequestLifetimeScope; var dataEventHandler = autofacLifetimeScope.Resolve <DataEventProcessor>(); dataEventHandler.PublishDynamicContent(updatedEventInfo.Item); }
private static void IDynamicContentDeletingEvent(IDynamicContentDeletingEvent eventInfo) { // Notice we are using IDynamicContentDeletingEvent instead of IDynamicContentDeletedEvent // The only difference is that Deleting occurs before the transation is submitted to the database. But, it does occur after permission checks. The only reason this would fail // would be due to do a bug or database connection. We have to do this because IDynamicContentDeletedEvent occurs AFTER it has been deleted from the database. And Sitefinity // doesn't have access to the SystemParentId at that point. if (eventInfo.Item.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live) { if (eventInfo.Item.GetType() == HogwartsConstants.activityType) { // An activity was deleted. Purge the cache for whichever house it belongs to CacheDependency.Notify(new List <CacheDependencyKey>() { new CacheDependencyKey() { Key = eventInfo.Item.SystemParentId.ToString(), Type = HogwartsConstants.houseType } }); } else if (eventInfo.Item.GetType() == HogwartsConstants.houseType) { // House has been deleted. Purge the HouseKeys cache so the house disappears from the list // ... Yes. I know that Hogwarts will only ever have 4 houses... CacheDependency.Notify(new List <CacheDependencyKey>() { new CacheDependencyKey() { Key = HogwartsConstants.cacheKeysInstanceName, Type = HogwartsConstants.houseType } }); } } }
private void DynamicContentDeletedEventHandler(IDynamicContentDeletingEvent evt) { var item = evt.Item; var itemType = item.GetType(); var url = System.Web.HttpContext.Current.Request.Url.Host; var helper = new IAFCHandBookHelper(url); if (itemType == helper.ResourceType || itemType == helper.ExternalResourcesType) { if (item.Status == ContentLifecycleStatus.Live) { if (helper.IsHandBookResourcesDataExistsFor(item.Id, itemType)) { helper.DeleteIAFCHandBookResourcesData(item.Id, itemType); } } } }