本文整理汇总了C#中PageReference.ToReferenceWithoutVersion方法的典型用法代码示例。如果您正苦于以下问题:C# PageReference.ToReferenceWithoutVersion方法的具体用法?C# PageReference.ToReferenceWithoutVersion怎么用?C# PageReference.ToReferenceWithoutVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageReference
的用法示例。
在下文中一共展示了PageReference.ToReferenceWithoutVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: List
public PageDataCollection List(PageReference pageLink)
{
string key = CachedFindPagesWithCriterion.GetCacheKey(pageLink.ToReferenceWithoutVersion());
var standardPages = _synchronizedObjectInstanceCache.Get(key) as PageDataCollection;
if (standardPages == null)
{
object miniLock = MiniLocks.GetOrAdd(key, k => new object());
lock (miniLock)
{
standardPages = _synchronizedObjectInstanceCache.Get(key) as PageDataCollection;
if (standardPages == null)
{
string pageTypeId = _pageTypeRepository.Load<StandardPage>()?.ID.ToString();
if (pageTypeId == null)
{
return new PageDataCollection();
}
PropertyCriteria productPageTypeCriterion = new PropertyCriteria
{
Name = "PageTypeID",
Type = PropertyDataType.PageType,
Value = pageTypeId,
Condition = CompareCondition.Equal,
Required = true
};
var criteria = new PropertyCriteriaCollection
{
productPageTypeCriterion
};
standardPages = _searchPages.FindPagesWithCriteria(pageLink, criteria);
Thread.Sleep(5000);
_synchronizedObjectInstanceCache.Insert(key, standardPages, CacheEvictionPolicy.Empty);
// Saving some space we will release the lock
object temp1;
if (MiniLocks.TryGetValue(key, out temp1) && (temp1 == miniLock))
{
object temp2;
MiniLocks.TryRemove(key, out temp2);
}
}
}
}
return standardPages;
}
示例2: List
public PageDataCollection List(PageReference pageLink)
{
string cacheKey = CachedFindPagesWithCriterion.GetCacheKey(pageLink.ToReferenceWithoutVersion());
var standardPages = _synchronizedObjectInstanceCache.Get(cacheKey) as PageDataCollection;
if (standardPages == null)
{
lock (Lock)
{
// Check cache again since standardPages might have been cached while waiting for the lock to open
standardPages = _synchronizedObjectInstanceCache.Get(cacheKey) as PageDataCollection;
if (standardPages == null)
{
string pageTypeId = _pageTypeRepository.Load<StandardPage>()?.ID.ToString();
if (pageTypeId == null)
{
return new PageDataCollection();
}
PropertyCriteria productPageTypeCriterion = new PropertyCriteria
{
Name = "PageTypeID",
Type = PropertyDataType.PageType,
Value = pageTypeId,
Condition = CompareCondition.Equal,
Required = true
};
var criteria = new PropertyCriteriaCollection
{
productPageTypeCriterion
};
standardPages = _searchPages.FindPagesWithCriteria(pageLink, criteria);
Thread.Sleep(5000);
_synchronizedObjectInstanceCache.Insert(cacheKey, standardPages, CacheEvictionPolicy.Empty);
}
}
}
return standardPages;
}
示例3: List
public PageDataCollection List(PageReference pageLink)
{
string cacheKey = GetCacheKey(pageLink.ToReferenceWithoutVersion());
var standardPages = _synchronizedObjectInstanceCache.Get(cacheKey) as PageDataCollection;
if (standardPages == null)
{
string pageTypeId = _pageTypeRepository.Load<StandardPage>()?.ID.ToString();
if (pageTypeId == null)
{
return new PageDataCollection();
}
PropertyCriteria productPageTypeCriterion = new PropertyCriteria
{
Name = "PageTypeID",
Type = PropertyDataType.PageType,
Value = pageTypeId,
Condition = CompareCondition.Equal,
Required = true
};
var criteria = new PropertyCriteriaCollection
{
productPageTypeCriterion
};
standardPages = _searchPages.FindPagesWithCriteria(pageLink, criteria);
// Lots of things can happen while fetching the cache
Thread.Sleep(1000);
// Actually caching the ContentData is not a good practice. Caching the ContentReference is better
_synchronizedObjectInstanceCache.Insert(cacheKey, standardPages, CacheEvictionPolicy.Empty);
}
return standardPages;
}
示例4: GetPage
protected PageData GetPage(PageReference pageRef)
{
IContentRepository contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
ContentReference contentLink = pageRef.ToReferenceWithoutVersion();
PageData pageData = contentRepository.Get<PageData>(contentLink);
if (pageData == null)
{
throw new NullReferenceException("Cannot Load Page: " + pageRef.ToString());
}
return pageData;
}