Ejemplo n.º 1
0
        /// <summary>
        /// If you need to have a custom Cache Dependency, you will need to use custom Caching
        /// </summary>
        /// <returns>All the Example Pages</returns>
        public IEnumerable <ExamplePageTypeModel> GetExamplePages_CustomCacheDependency()
        {
            // Get the Pages
            return(mCacheHelper.Cache <IEnumerable <ExamplePageTypeModel> >(() =>
            {
                var Pages = ExamplePageTypeProvider.GetExamplePageTypes()
                            .LatestVersion(mLatestVersionEnabled)
                            .Published(!mLatestVersionEnabled)
                            .OnSite(SiteContext.CurrentSiteName)
                            .Culture(mCultureName)
                            .CombineWithDefaultCulture()
                            .OrderBy("NodeOrder")
                            .ToList();

                // Convert to Model
                return Pages.Select(x =>
                {
                    return new ExamplePageTypeModel()
                    {
                        Name = x.Name,
                        ID = x.NodeID
                    };
                }).ToList();
            }, "KenticoExamplePageTypeRepository.GetExamplePages", GetExamplePagesCacheDependency(), mCacheHelper.CacheDuration()));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// No Cache needed as the Interceptor will detect the return type is IEnumerable of TreeNode and add the "nodes|sitename|classname|all" dependency
 /// </summary>
 /// <returns>Get All Example Pages</returns>
 public IEnumerable <ExamplePageType> GetExamplePages_TreeNodes()
 {
     return(ExamplePageTypeProvider.GetExamplePageTypes()
            .LatestVersion(mLatestVersionEnabled)
            .Published(!mLatestVersionEnabled)
            .OnSite(SiteContext.CurrentSiteName)
            .Culture(mCultureName)
            .CombineWithDefaultCulture()
            .OrderBy("NodeOrder")
            .ToList());
 }
Ejemplo n.º 3
0
        public IEnumerable <ExamplePageTypeModel> GetExamplePages()
        {
            var Pages = ExamplePageTypeProvider.GetExamplePageTypes()
                        .LatestVersion(mLatestVersionEnabled)
                        .Published(!mLatestVersionEnabled)
                        .OnSite(SiteContext.CurrentSiteName)
                        .Culture(mCultureName)
                        .CombineWithDefaultCulture()
                        .ToList();

            // Convert to Model
            return(Pages.Select(x =>
            {
                return new ExamplePageTypeModel()
                {
                    Name = x.Name,
                    ID = x.NodeID
                };
            }).ToList());
        }