当前位置: 首页>>代码示例>>C#>>正文


C# ContentReference.ToReferenceWithoutVersion方法代码示例

本文整理汇总了C#中EPiServer.Core.ContentReference.ToReferenceWithoutVersion方法的典型用法代码示例。如果您正苦于以下问题:C# ContentReference.ToReferenceWithoutVersion方法的具体用法?C# ContentReference.ToReferenceWithoutVersion怎么用?C# ContentReference.ToReferenceWithoutVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EPiServer.Core.ContentReference的用法示例。


在下文中一共展示了ContentReference.ToReferenceWithoutVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetContent

        public IEnumerable<PageData> GetContent(ContentReference contentRef, string scope = null)
        {
            var refs = scope == null ?
                Store.Items<CategoryAssignment>().Where(ca => ca.CategoryPage == contentRef.ToReferenceWithoutVersion()).ToList() :
                Store.Items<CategoryAssignment>().Where(ca => ca.CategoryPage == contentRef.ToReferenceWithoutVersion() && ca.Scope == scope).ToList();

            var repo = ServiceLocator.Current.GetInstance<IContentRepository>();

            return refs.Select(ca => repo.Get<PageData>(ca.ContentPage)).Where(x => !x.IsDeleted);
        }
开发者ID:deanebarker,项目名称:Episerver-Extended-Categories,代码行数:10,代码来源:CategoryRepository.cs

示例2: DeleteAssignmentsByCategory

 public void DeleteAssignmentsByCategory(ContentReference categoryRef)
 {
     if (Store.Items<CategoryAssignment>().Where(ca => ca.ContentPage == categoryRef.ToReferenceWithoutVersion()).Count() > 0)
     {
         foreach (var item in Store.Items<CategoryAssignment>().Where(ca => ca.CategoryPage == categoryRef.ToReferenceWithoutVersion()))
         {
             Store.Delete(item);
         }
     }
 }
开发者ID:deanebarker,项目名称:Episerver-Extended-Categories,代码行数:10,代码来源:CategoryRepository.cs

示例3: AddAssignment

        public void AddAssignment(ContentReference contentRef, ContentReference categoryRef, string scope)
        {
            contentRef = contentRef.ToReferenceWithoutVersion();
            categoryRef = categoryRef.ToReferenceWithoutVersion();

            var matchingAssignments = Store.Items<CategoryAssignment>().Where(ca => ca.ContentPage == contentRef && ca.CategoryPage == categoryRef && ca.Scope == scope);
            if(matchingAssignments.Count() > 0)
            {
                return;
            }

            var categoryAssignment = new CategoryAssignment()
            {
                ContentPage = contentRef,
                CategoryPage = categoryRef,
                Scope = scope
            };
            Store.Save(categoryAssignment);
        }
开发者ID:deanebarker,项目名称:Episerver-Extended-Categories,代码行数:19,代码来源:CategoryRepository.cs

示例4: GetHrefLangDataFromCache

        protected virtual IEnumerable<HrefLangData> GetHrefLangDataFromCache(ContentReference contentLink)
        {
            var cacheKey = string.Format("HrefLangData-{0}", contentLink.ToReferenceWithoutVersion());
            var cachedObject = CacheManager.Get(cacheKey) as IEnumerable<HrefLangData>;

            if (cachedObject == null)
            {
                cachedObject = GetHrefLangData(contentLink);
                CacheManager.Insert(cacheKey, cachedObject, new CacheEvictionPolicy(null, new [] { "SitemapGenerationKey" }, TimeSpan.FromMinutes(10), CacheTimeoutType.Absolute));
            }

            return cachedObject;
        } 
开发者ID:MEmanuelsson,项目名称:SEO.Sitemaps,代码行数:13,代码来源:SitemapXmlGenerator.cs


注:本文中的EPiServer.Core.ContentReference.ToReferenceWithoutVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。