コード例 #1
0
        public override IList <Technology> GetList(bool includeRelatedEntities = true)
        {
            var technologyList = EntityCache.Get <List <Technology> >(TechnologyListKey);

            if (technologyList == null)
            {
                var technologies = Context.Technologies.AsQueryable();
                if (includeRelatedEntities)
                {
                    technologies = technologies
                                   .Include(t => t.Resources);
                }
                technologyList = technologies
                                 .OrderBy(t => t.Name)
                                 .ToList();
                EntityCache.Add(TechnologyListKey, technologyList);
            }
            return(technologyList);
        }
コード例 #2
0
        public override IList <Section> GetList(bool includeRelatedEntities = true)
        {
            var sectionsList = EntityCache.Get <List <Section> >(SectionsListKey);

            if (sectionsList == null)
            {
                var sections = Context.Sections.AsQueryable();
                if (includeRelatedEntities)
                {
                    sections = sections
                               .Include(s => s.Resources);
                }
                sectionsList = sections
                               .OrderBy(s => s.Name)
                               .ToList();
                EntityCache.Add(SectionsListKey, sectionsList);
            }
            return(sectionsList);
        }
コード例 #3
0
        public override IList <Tag> GetList(bool includeRelatedEntities = true)
        {
            var tagList = EntityCache.Get <List <Tag> >(TagListKey);

            if (tagList == null)
            {
                var tags = Context.Tags.AsQueryable();
                if (includeRelatedEntities)
                {
                    tags = tags
                           .Include(t => t.Posts);
                }
                tagList = tags
                          .OrderBy(t => t.Name)
                          .ToList();
                EntityCache.Add(TagListKey, tagList);
            }
            return(tagList);
        }
コード例 #4
0
        public override IList <Category> GetList(bool includeRelatedEntities = true)
        {
            var categoryList = EntityCache.Get <List <Category> >(CategoryListKey);

            if (categoryList == null)
            {
                var category = Context.Categories.AsQueryable();

                if (includeRelatedEntities)
                {
                    category = category
                               .Include(c => c.Resources);
                }
                categoryList = category
                               .OrderBy(c => c.Name)
                               .ToList();
                EntityCache.Add(CategoryListKey, categoryList);
            }
            return(categoryList);
        }
コード例 #5
0
        public override IList <Post> GetList(bool includeRelatedEntities = true)
        {
            var postList = EntityCache.Get <List <Post> >(PostListKey);

            if (postList == null)
            {
                var posts = Context.Posts.AsQueryable();
                if (includeRelatedEntities)
                {
                    posts = posts
                            .Include(p => p.PostCategory)
                            .Include(p => p.Tags.Select(t => t.Tag));
                }
                postList = posts
                           .OrderBy(p => p.PostedOn)
                           .ToList();
                EntityCache.Add(PostListKey, postList);
            }
            return(postList);
        }
コード例 #6
0
        public override IList <Resource> GetList(bool includeRelatedEntities = true)
        {
            var resourceList = EntityCache.Get <List <Resource> >(ResourceListKey);

            if (resourceList == null)
            {
                var resources = Context.Resources.AsQueryable();
                if (includeRelatedEntities)
                {
                    resources = resources
                                .Include(r => r.Section)
                                .Include(r => r.Category);
                }
                resourceList = resources
                               .OrderBy(s => s.Name)
                               .ToList();
                EntityCache.Add(ResourceListKey, resourceList);
            }
            return(resourceList);
        }