/// <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())); }
public ExamplePageType GetExamplePage_TreeNode(int ID) { return(ExamplePageTypeProvider.GetExamplePageType(ID, mCultureName, SiteContext.CurrentSiteName) .LatestVersion(mLatestVersionEnabled) .Published(!mLatestVersionEnabled) .CombineWithDefaultCulture() .FirstOrDefault()); }
/// <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()); }
public ExamplePageTypeModel GetExamplePage(Guid guid) { // Get the Page var Page = ExamplePageTypeProvider.GetExamplePageType(guid, mCultureName, SiteContext.CurrentSiteName) .LatestVersion(mLatestVersionEnabled) .Published(!mLatestVersionEnabled) .CombineWithDefaultCulture() .FirstOrDefault(); // Convert to Model return(new ExamplePageTypeModel() { Name = Page.Name, ID = Page.NodeID }); }
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()); }