本文整理汇总了C#中MrCMS.Entities.Documents.Web.Webpage.Unproxy方法的典型用法代码示例。如果您正苦于以下问题:C# Webpage.Unproxy方法的具体用法?C# Webpage.Unproxy怎么用?C# Webpage.Unproxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MrCMS.Entities.Documents.Web.Webpage
的用法示例。
在下文中一共展示了Webpage.Unproxy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValidWebpageDocumentTypes
public IEnumerable<DocumentMetadata> GetValidWebpageDocumentTypes(Webpage webpage, Func<DocumentMetadata, bool> predicate)
{
var documentTypeDefinitions = new HashSet<DocumentMetadata>();
if (webpage == null)
documentTypeDefinitions = new HashSet<DocumentMetadata>(
DocumentMetadataHelper.WebpageMetadata.Where(definition => !definition.RequiresParent));
else
{
var documentTypeDefinition =
DocumentMetadataHelper.WebpageMetadata.FirstOrDefault(
definition => definition.TypeName == webpage.Unproxy().GetType().Name);
if (documentTypeDefinition == null) return Enumerable.Empty<DocumentMetadata>();
IEnumerable<DocumentMetadata> metadatas = documentTypeDefinition.ChildrenList.Select(DocumentMetadataHelper.GetMetadata);
switch (documentTypeDefinition.ChildrenListType)
{
case ChildrenListType.BlackList:
IEnumerable<DocumentMetadata> documentMetadatas =
DocumentMetadataHelper.WebpageMetadata.Except(metadatas).Where(def => !def.AutoBlacklist);
documentMetadatas.ForEach(item => documentTypeDefinitions.Add(item));
break;
case ChildrenListType.WhiteList:
metadatas.ForEach(metadata => documentTypeDefinitions.Add(metadata));
break;
}
}
documentTypeDefinitions.RemoveWhere(
definition => typeof(IUniquePage).IsAssignableFrom(definition.Type) && _existAnyWebpageService.ExistAny(definition.Type));
if (predicate != null)
{
documentTypeDefinitions.RemoveWhere(metadata => !predicate(metadata));
}
return documentTypeDefinitions;
}
示例2: GetValidParentTypes
public static List<DocumentMetadata> GetValidParentTypes(Webpage webpage)
{
Type type = webpage.Unproxy().GetType();
return DocumentMetadatas.FindAll(metadata => metadata.ValidChildrenTypes.Contains(type));
}