本文整理汇总了C#中EPiServer.Core.ContentReference.CompareToIgnoreWorkID方法的典型用法代码示例。如果您正苦于以下问题:C# ContentReference.CompareToIgnoreWorkID方法的具体用法?C# ContentReference.CompareToIgnoreWorkID怎么用?C# ContentReference.CompareToIgnoreWorkID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EPiServer.Core.ContentReference
的用法示例。
在下文中一共展示了ContentReference.CompareToIgnoreWorkID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLayoutModel
public virtual LayoutModel CreateLayoutModel(ContentReference currentContentLink, RequestContext requestContext)
{
var startPageContentLink = SiteDefinition.Current.StartPage;
// Use the content link with version information when editing the startpage,
// otherwise the published version will be used when rendering the props below.
if (currentContentLink.CompareToIgnoreWorkID(startPageContentLink))
{
startPageContentLink = currentContentLink;
}
var startPage = _contentLoader.Get<StartPage>(startPageContentLink);
return new LayoutModel
{
Logotype = startPage.SiteLogotype,
LogotypeLinkUrl = new MvcHtmlString(_urlResolver.GetUrl(SiteDefinition.Current.StartPage)),
ProductPages = startPage.ProductPageLinks,
CompanyInformationPages = startPage.CompanyInformationPageLinks,
NewsPages = startPage.NewsPageLinks,
CustomerZonePages = startPage.CustomerZonePageLinks,
LoggedIn = requestContext.HttpContext.User.Identity.IsAuthenticated,
LoginUrl = new MvcHtmlString(GetLoginUrl(currentContentLink)),
SearchActionUrl = new MvcHtmlString(EPiServer.Web.Routing.UrlResolver.Current.GetUrl(startPage.SearchPageLink))
};
}
示例2: ResolveContent
protected override Web.ContentResolveResult ResolveContent(ContentReference contentLink)
{
var contentData = ContentCoreDataLoader.Service.Load(contentLink.ID);
// All pages but the entry root should appear to come from this content provider
if (!contentLink.CompareToIgnoreWorkID(EntryRoot))
{
contentData.ContentReference.ProviderName = ProviderKey;
}
var result = CreateContentResolveResult(contentData);
if (!result.ContentLink.CompareToIgnoreWorkID(EntryRoot))
{
result.ContentLink.ProviderName = ProviderKey;
}
return result;
}
示例3: CreateHrefLangData
protected virtual HrefLangData CreateHrefLangData(ContentReference contentLink, CultureInfo language, CultureInfo masterLanguage)
{
string languageUrl = UrlResolver.GetUrl(contentLink, language.Name);
string masterLanguageUrl = UrlResolver.GetUrl(contentLink, masterLanguage.Name);
var data = new HrefLangData();
if (languageUrl.Equals(masterLanguageUrl) && contentLink.CompareToIgnoreWorkID(this.SiteSettings.StartPage))
{
data.HrefLang = "x-default";
}
else
{
data.HrefLang = language.Name.ToLowerInvariant();
}
data.Href = GetAbsoluteUrl(languageUrl);
return data;
}
示例4: ConstructContentUri
protected override Uri ConstructContentUri(int contentTypeId, ContentReference contentLink, Guid contentGuid)
{
if (!contentLink.CompareToIgnoreWorkID(EntryRoot))
{
contentLink.ProviderName = ProviderKey;
}
return base.ConstructContentUri(contentTypeId, contentLink, contentGuid);
}
示例5: LoadChildrenReferences
protected override IList<ContentReference> LoadChildrenReferences(ContentReference contentLink, string languageID, out bool languageSpecific)
{
// If retrieving children for the entry point, we retrieve pages from the clone root
contentLink = contentLink.CompareToIgnoreWorkID(EntryRoot) ? CloneRoot : contentLink;
FilterSortOrder sortOrder;
var children = ContentStore.LoadChildrenReferences(contentLink.ID, languageID, out sortOrder);
languageSpecific = sortOrder == FilterSortOrder.Alphabetical;
foreach (var contentReference in children.Where(contentReference => !contentReference.CompareToIgnoreWorkID(EntryRoot)))
{
contentReference.ProviderName = ProviderKey;
}
return FilterByCategory(children);
}
示例6: GetDescendentReferences
public override IList<ContentReference> GetDescendentReferences(ContentReference contentLink)
{
// If retrieving children for the entry point, we retrieve pages from the clone root
contentLink = contentLink.CompareToIgnoreWorkID(EntryRoot) ? CloneRoot : contentLink;
var descendents = ContentStore.ListAll(contentLink);
foreach (var contentReference in descendents.Where(contentReference => !contentReference.CompareToIgnoreWorkID(EntryRoot)))
{
contentReference.ProviderName = ProviderKey;
}
return FilterByCategory(descendents);
}
示例7: ResolveContent
/// <summary>
/// The resolve content.
/// </summary>
/// <param name="contentLink">
/// The content link.
/// </param>
/// <returns>
/// The <see cref="ContentResolveResult"/>.
/// </returns>
/// <remarks>
/// This method should be implemented to support permanent link support. With permanent link means that a link to a
/// <see cref="T:EPiServer.Core.IContent"/>
/// instance
/// can be stored in a Guid based format. Then the link is not broken even if content instance moves. Also permanent links are preserved during import/export and
/// mirroring.
/// </remarks>
protected override ContentResolveResult ResolveContent(ContentReference contentLink)
{
if (ContentReference.IsNullOrEmpty(contentLink))
{
return null;
}
ContentCoreData contentData = this.ContentCoreDataLoader.Service.Load(contentLink.ID);
// All pages but the entry root should appear to come from this content provider
if (!contentLink.CompareToIgnoreWorkID(this.EntryRoot))
{
contentData.ContentReference.ProviderName = this.ProviderKey;
}
ContentResolveResult result = this.CreateContentResolveResult(contentData);
if (!result.ContentLink.CompareToIgnoreWorkID(this.EntryRoot))
{
result.ContentLink.ProviderName = this.ProviderKey;
}
return result;
}
示例8: LoadChildrenReferences
/// <summary>
/// The load children references.
/// </summary>
/// <param name="contentLink">
/// The content link.
/// </param>
/// <param name="languageID">
/// The language id.
/// </param>
/// <param name="languageSpecific">
/// The language specific.
/// </param>
/// <returns>
/// An <see cref="IList{ContentReference}"/> of children.
/// </returns>
/// <remarks>
/// If the provider supports structure this method should be implemented.
/// </remarks>
protected override IList<ContentReference> LoadChildrenReferences(
ContentReference contentLink, string languageID, out bool languageSpecific)
{
if (ContentReference.IsNullOrEmpty(contentLink))
{
languageSpecific = false;
return new List<ContentReference>();
}
// If retrieving children for the entry point, we retrieve pages from the clone root
contentLink = contentLink.CompareToIgnoreWorkID(this.EntryRoot) ? this.CloneRoot : contentLink;
FilterSortOrder sortOrder;
IList<ContentReference> children = this.ContentStore.LoadChildrenReferences(
contentLink.ID, languageID, out sortOrder);
languageSpecific = sortOrder == FilterSortOrder.Alphabetical;
foreach (ContentReference contentReference in
children.Where(contentReference => !contentReference.CompareToIgnoreWorkID(this.EntryRoot)))
{
contentReference.ProviderName = this.ProviderKey;
}
return this.FilterByCategory(children);
}
示例9: ConstructContentUri
/// <summary>
/// The construct content uri.
/// </summary>
/// <param name="contentTypeId">
/// The content type id.
/// </param>
/// <param name="contentLink">
/// The content link.
/// </param>
/// <param name="contentGuid">
/// The content guid.
/// </param>
/// <returns>
/// The <see cref="Uri"/> of the content.
/// </returns>
/// <exception cref="System.ArgumentNullException">
/// contentLink
/// </exception>
protected override Uri ConstructContentUri(int contentTypeId, ContentReference contentLink, Guid contentGuid)
{
if (ContentReference.IsNullOrEmpty(contentLink))
{
throw new ArgumentNullException("contentLink");
}
if (!contentLink.CompareToIgnoreWorkID(this.EntryRoot))
{
contentLink.ProviderName = this.ProviderKey;
}
return base.ConstructContentUri(contentTypeId, contentLink, contentGuid);
}
示例10: GetDescendentReferences
/// <summary>
/// The get descendent references.
/// </summary>
/// <param name="contentLink">
/// The content link.
/// </param>
/// <returns>
/// A <see cref="IList{ContentReference}"/> of descendents.
/// </returns>
public override IList<ContentReference> GetDescendentReferences(ContentReference contentLink)
{
if (ContentReference.IsNullOrEmpty(contentLink))
{
return new List<ContentReference>();
}
// If retrieving children for the entry point, we retrieve pages from the clone root
contentLink = contentLink.CompareToIgnoreWorkID(this.EntryRoot) ? this.CloneRoot : contentLink;
IList<ContentReference> descendents = this.ContentStore.ListAll(contentLink);
foreach (ContentReference contentReference in
descendents.Where(contentReference => !contentReference.CompareToIgnoreWorkID(this.EntryRoot)))
{
contentReference.ProviderName = this.ProviderKey;
}
return this.FilterByCategory(descendents);
}