本文整理汇总了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);
}
示例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);
}
}
}
示例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);
}
示例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;
}