コード例 #1
0
ファイル: WikiPage.cs プロジェクト: jgauffin/Griffin.Wiki
        private void UpdateLinksInternal(PreProcessorContext result, IPageRepository repository)
        {
            var added = result.LinkedPages.Except(References.Select(k => k.PagePath)).ToList();
            if (added.Any())
            {
                var pages = repository.GetPages(added);
                foreach (var page in pages)
                {
                    page.BackReferences.Any(); // lazy load.
                    page._backReferences.Add(this);
                }


                var missingPages = added.Except(pages.Select(x => x.PagePath));
                repository.AddMissingLinks(this, missingPages);
            }


            var removed = References.Select(k => k.PagePath).Except(result.LinkedPages).ToList();
            if (removed.Any())
                RemoveBackLinks(removed);
        }