private bool changeState(ScheduleItemCommentAddress commentAddress, EntityState state, string pluginEventName) { bool commentStateChanged = false; ScheduleItemComment comment = getComment(commentAddress); using (TransactionScope transaction = new TransactionScope()) { if (comment != null && comment.State != state) { commentRepository.ChangeState(comment.ID, state); commentStateChanged = commentRepository.GetComment(comment.ID).State == state; } if (commentStateChanged) { cache.InvalidateItem(comment); } transaction.Complete(); } if (commentStateChanged) { pluginEngine.ExecuteAll(pluginEventName, new { context, parent = new ScheduleItemSmallReadOnly(comment.ScheduleItem), comment = new CommentReadOnly(comment, absolutePathHelper.GetAbsolutePath(comment)) }); } return(commentStateChanged); }
private void invalidateCachedCommentDependencies(ScheduleItemComment comment) { if (comment.Parent != null) { cache.InvalidateItem(new ScheduleItemComment(comment.Parent.ID)); } cache.InvalidateItem(new ScheduleItem(comment.ScheduleItem.ID)); }
private void invalidateCachedPageForEdit(Page newPage, Page originalPage) { //if ((originalPage.Parent != null ? originalPage.Parent.ID : Guid.Empty) != (newPage.Parent != null ? newPage.Parent.ID : Guid.Empty)) //{ // if (originalPage.Parent != null) // invalidateCachedPageDependencies(originalPage.Parent); // if (newPage.Parent != null) // invalidateCachedPageDependencies(newPage.Parent); //} cache.InvalidateItem(newPage); }
private void invalidateCachedCommentDependencies(PostComment comment) { if (comment.Parent != null) { cache.InvalidateItem(new PostComment(comment.Parent.ID)); } cache.InvalidateItem(new Post(comment.Post.ID)); }
public ModelResult <Exhibitor> SaveExhibitor(EventAddress eventAddress, Exhibitor exhibitor) { ValidationStateDictionary validationState = new ValidationStateDictionary(); // todo (dcrenna) validation if (!validationState.IsValid) { return(new ModelResult <Exhibitor>(validationState)); } using (var transaction = new TransactionScope()) { exhibitor = repository.SaveExhibitor(eventAddress, exhibitor); transaction.Complete(); } cache.InvalidateItem(exhibitor); return(new ModelResult <Exhibitor>(exhibitor, validationState)); }
private void invalidateCachedBlogDependencies(Blog blog) { cache.InvalidateItem(blog.Site); cache.Invalidate(string.Format("GetBlogExists-Name:{0}", blog.Name)); }
private void invalidateCachedPostDependencies(Post post) { cache.InvalidateItem(post.Blog); post.Tags.ToList().ForEach(t => cache.InvalidateItem(t)); }
private void invalidateCachedUserForEdit(UserAuthenticated newUser, UserAuthenticated originalUser) { // UserAuthenticated doesn't have any dependencies cache.InvalidateItem(newUser); }