コード例 #1
0
        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);
        }
コード例 #2
0
        private void invalidateCachedCommentDependencies(ScheduleItemComment comment)
        {
            if (comment.Parent != null)
            {
                cache.InvalidateItem(new ScheduleItemComment(comment.Parent.ID));
            }

            cache.InvalidateItem(new ScheduleItem(comment.ScheduleItem.ID));
        }
コード例 #3
0
ファイル: PageService.cs プロジェクト: ljvblfz/MicrosoftOxite
        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);
        }
コード例 #4
0
        private void invalidateCachedCommentDependencies(PostComment comment)
        {
            if (comment.Parent != null)
            {
                cache.InvalidateItem(new PostComment(comment.Parent.ID));
            }

            cache.InvalidateItem(new Post(comment.Post.ID));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        private void invalidateCachedBlogDependencies(Blog blog)
        {
            cache.InvalidateItem(blog.Site);

            cache.Invalidate(string.Format("GetBlogExists-Name:{0}", blog.Name));
        }
コード例 #7
0
ファイル: PostService.cs プロジェクト: ljvblfz/MicrosoftOxite
        private void invalidateCachedPostDependencies(Post post)
        {
            cache.InvalidateItem(post.Blog);

            post.Tags.ToList().ForEach(t => cache.InvalidateItem(t));
        }
コード例 #8
0
        private void invalidateCachedUserForEdit(UserAuthenticated newUser, UserAuthenticated originalUser)
        {
            // UserAuthenticated doesn't have any dependencies

            cache.InvalidateItem(newUser);
        }