本文整理汇总了C#中IContent.GetCreatorProfile方法的典型用法代码示例。如果您正苦于以下问题:C# IContent.GetCreatorProfile方法的具体用法?C# IContent.GetCreatorProfile怎么用?C# IContent.GetCreatorProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContent
的用法示例。
在下文中一共展示了IContent.GetCreatorProfile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PagePublishedContent
public PagePublishedContent(IContent inner)
{
if (inner == null)
throw new NullReferenceException("content");
_inner = inner;
_id = _inner.Id;
_creatorName = _inner.GetCreatorProfile().Name;
_writerName = _inner.GetWriterProfile().Name;
_contentType = new PublishedContentType(_inner.ContentType);
_properties = _contentType.PropertyTypes
.Select(x =>
{
var p = _inner.Properties.SingleOrDefault(xx => xx.Alias == x.PropertyTypeAlias);
return p == null ? new PagePublishedProperty(x, this) : new PagePublishedProperty(x, this, p);
})
.Cast<IPublishedProperty>()
.ToArray();
_parent = new PagePublishedContent(_inner.ParentId);
}
示例2: Export
/// <summary>
/// Exports an <see cref="IContent"/> item to xml as an <see cref="XElement"/>
/// </summary>
/// <param name="content">Content to export</param>
/// <param name="deep">Optional parameter indicating whether to include descendents</param>
/// <returns><see cref="XElement"/> containing the xml representation of the Content object</returns>
internal XElement Export(IContent content, bool deep = false)
{
//nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck();
var xml = Export(content, nodeName);
xml.Add(new XAttribute("nodeType", content.ContentType.Id));
xml.Add(new XAttribute("creatorName", content.GetCreatorProfile().Name));
xml.Add(new XAttribute("writerName", content.GetWriterProfile().Name));
xml.Add(new XAttribute("writerID", content.WriterId));
xml.Add(new XAttribute("template", content.Template == null ? "0" : content.Template.Id.ToString(CultureInfo.InvariantCulture)));
xml.Add(new XAttribute("nodeTypeAlias", content.ContentType.Alias));
if (deep)
{
var descendants = content.Descendants().ToArray();
var currentChildren = descendants.Where(x => x.ParentId == content.Id);
AddChildXml(descendants, currentChildren, xml);
}
return xml;
}
示例3: SerialiseContent
/// <summary>
/// Serialize IContent to XElement and adds dependent nodes
/// </summary>
/// <param name="content">Umbraco IContent object</param>
/// <param name="dependantNodes">this function will add dependent nodes to this collection</param>
/// <returns>returns serialized version of IContent as XElement</returns>
public XElement SerialiseContent(IContent content, Dictionary<int, ObjectTypes> dependantNodes = null)
{
dependantNodes = dependantNodes ?? new Dictionary<int, ObjectTypes>();
var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck();
var currentContent = new XElement(nodeName,
new XAttribute("nodeName", content.Name),
new XAttribute("nodeType", content.ContentType.Id),
new XAttribute("creatorName", content.GetCreatorProfile().Name),
new XAttribute("writerName", content.GetWriterProfile().Name),
new XAttribute("writerID", content.WriterId),
new XAttribute("templateID", content.Template == null ? "0" : content.Template.Id.ToString(CultureInfo.InvariantCulture)),
new XAttribute("nodeTypeAlias", content.ContentType.Alias),
new XAttribute("id", content.Id),
new XAttribute("parentID", content.Level > 1 ? content.ParentId : -1),
new XAttribute("level", content.Level),
new XAttribute("creatorID", content.CreatorId),
new XAttribute("sortOrder", content.SortOrder),
new XAttribute("createDate", content.CreateDate.ToString("s")),
new XAttribute("updateDate", content.UpdateDate.ToString("s")),
new XAttribute("path", content.Path),
new XAttribute("isDoc", string.Empty),
new XAttribute("releaseDate", content.ReleaseDate != null ? content.ReleaseDate.Value.ToString("s") : DateTime.MinValue.ToString("s")),
new XAttribute("expireDate", content.ExpireDate != null ? content.ExpireDate.Value.ToString("s") : DateTime.MinValue.ToString("s")),
new XAttribute("parentGuid", content.Level > 1 ? content.Parent().Key.ToString() : string.Empty),
new XAttribute("guid", content.Key),
new XAttribute("objectType", ObjectTypes.Document),
new XAttribute("published", content.Published));
var propertyTypes = content.PropertyTypes.ToArray();
var count = 0;
foreach (var property in content.Properties)
{
var tag = property.ToXml();
var propertyType = propertyTypes.ElementAt(count);
tag.Add(new XAttribute("dataTypeGuid", propertyType.DataTypeId));
tag.Add(new XAttribute("dataTypeName", Services.DataTypeService.GetDataTypeDefinitionById(propertyType.DataTypeDefinitionId).Name));
var guid = propertyTypes.ElementAt(count).DataTypeId;
// TODO for v6
if (guid == new Guid(Constants.UploadDataTypeGuid) && property.Value != null)
{
var umbracoFile = property.Value.ToString();
tag.Add(
new XAttribute("umbracoFile", umbracoFile),
new XAttribute("fileName", umbracoFile.Split('/').Last()),
new XAttribute("objectType", ObjectTypes.File));
}
else if (SpecialDataTypes.ContainsKey(guid))
{
DataTypeConverterExport(property, tag, dependantNodes, SpecialDataTypes[guid]);
}
currentContent.Add(tag);
count++;
}
return currentContent;
}