本文整理汇总了C#中IPublishedContent.GetTemplateAlias方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.GetTemplateAlias方法的具体用法?C# IPublishedContent.GetTemplateAlias怎么用?C# IPublishedContent.GetTemplateAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPublishedContent
的用法示例。
在下文中一共展示了IPublishedContent.GetTemplateAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializableNode
public SerializableNode(IPublishedContent content, bool traverseChildren, bool getTemplateAlias = true)
{
if (traverseChildren)
this.Children = content.Children.Select(c => new SerializableNode(c, traverseChildren));
else
this.Children = new List<SerializableNode>();
//this.ContentType = content.ContentType;
//this.ContentSet = new List<PortableNode>();// content.ContentSet;
this.CreateDate = content.CreateDate;
this.CreatorId = content.CreatorId;
this.CreatorName = content.CreatorName;
this.DocumentTypeAlias = content.DocumentTypeAlias;
this.DocumentTypeId = content.DocumentTypeId;
this.Id = content.Id;
this.IsDraft = content.IsDraft;
this.ItemType = content.ItemType;
this.Level = content.Level;
this.Name = content.Name;
//this.Parent = content.Parent;
this.ParentId = (content.Parent == null) ? -1 : content.Parent.Id;
this.Path = content.Path;
//this.Properties = content.Properties;
//this.Properties = content.Properties.Select(p=>new SerializableProperty(p)).ToList<IPublishedProperty>();// new List<IPublishedProperty>();
this.PropertiesDictionary = content.Properties.ToDictionary(k => k.PropertyTypeAlias, k => k.DataValue);
this.SortOrder = content.SortOrder;
this.TemplateId = content.TemplateId;
this.TemplateAlias = content.GetTemplateAlias();
this.UpdateDate = content.UpdateDate;
this.Url = content.Url;
this.UrlName = content.UrlName;
this.Version = content.Version;
this.WriterId = content.WriterId;
this.WriterName = content.WriterName;
}
示例2: PageViewModel
public PageViewModel(IPublishedContent model)
{
Id = model.Id;
Name = model.Name;
Url = model.Url;
Path = model.Path;
ContentTypeAlias = model.ContentType.Alias;
CreateDate = model.CreateDate;
Template = model.GetTemplateAlias();
TemplateId = model.TemplateId;
Properties = new Dictionary<string,PropertyViewModel>();
foreach(var x in model.Properties) {
Properties.Add(x.PropertyTypeAlias, new PropertyViewModel() { DataValue = x.DataValue, HasValue = x.HasValue, PropertyTypeAlias = x.PropertyTypeAlias, Value = x.Value, XPathValue = x.XPathValue });
}
}
示例3: ContentHasTemplate
/// <summary>
/// Quick fix to all for checking if a content item has a template
/// </summary>
/// <param name="content">The <see cref="IPublishedContent"/></param>
/// <returns>True or false indicating whether or not the content has an associated template selected</returns>
private static bool ContentHasTemplate(IPublishedContent content)
{
try
{
var template = content.GetTemplateAlias();
return !string.IsNullOrEmpty(template);
}
catch (Exception)
{
return false;
}
}