Interface IPublishedContent
Represents a cached content.
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public interface IPublishedContent
Remarks
SD: A replacement for INode which needs to occur since INode doesn't contain the document type alias and INode is poorly formatted with mutable properties (i.e. Lists instead of IEnumerable).
Stephan: initially, that was for cached published content only. Now, we're using it also for cached preview (so, maybe unpublished) content. A better name would therefore be ICachedContent, as has been suggested. However, can't change now. Maybe in v7?
Properties
Children
Gets the children of the content.
Declaration
IEnumerable<IPublishedContent> Children { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IPublishedContent> |
Remarks
Children are sorted by their sortOrder.
ContentSet
Gets the content set to which the content belongs.
Declaration
IEnumerable<IPublishedContent> ContentSet { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IPublishedContent> |
Remarks
The default set consists in the siblings of the content (including the content
itself) ordered by sortOrder
.
ContentType
Gets the content type.
Declaration
PublishedContentType ContentType { get; }
Property Value
Type | Description |
---|---|
PublishedContentType |
CreateDate
Declaration
DateTime CreateDate { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
CreatorId
Declaration
int CreatorId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
CreatorName
Declaration
string CreatorName { get; }
Property Value
Type | Description |
---|---|
System.String |
DocumentTypeAlias
Declaration
string DocumentTypeAlias { get; }
Property Value
Type | Description |
---|---|
System.String |
DocumentTypeId
Declaration
int DocumentTypeId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Id
Declaration
int Id { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsDraft
Gets a value indicating whether the content is draft.
Declaration
bool IsDraft { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
A content is draft when it is the unpublished version of a content, which may have a published version, or not.
Item[String]
Gets the value of a property identified by its alias.
Declaration
object this[string alias] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The property alias. |
Property Value
Type | Description |
---|---|
System.Object | The value of the property identified by the alias. |
Remarks
If GetProperty(alias)
is null
then returns null
else return GetProperty(alias).Value
.
So if the property has no value, returns the default value for that property type.
This one is defined here really because we cannot define index extension methods, but all it should do is:
var p = GetProperty(alias); return p == null ? null : p.Value;
and nothing else.
The recursive syntax (eg "title") is _not supported here.
The alias is case-insensitive.
ItemType
Gets a value indicating whether the content is a content (aka a document) or a media.
Declaration
PublishedItemType ItemType { get; }
Property Value
Type | Description |
---|---|
PublishedItemType |
Level
Declaration
int Level { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Parent
Gets the parent of the content.
Declaration
IPublishedContent Parent { get; }
Property Value
Type | Description |
---|---|
IPublishedContent |
Remarks
The parent of root content is null
.
Path
Declaration
string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
Properties
Gets the properties of the content.
Declaration
ICollection<IPublishedProperty> Properties { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<IPublishedProperty> |
Remarks
Contains one IPublishedProperty
for each property defined for the content type, including
inherited properties. Some properties may have no value.
The properties collection of an IPublishedContent instance should be read-only ie it is illegal to add properties to the collection.
SortOrder
Declaration
int SortOrder { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TemplateId
Declaration
int TemplateId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
UpdateDate
Declaration
DateTime UpdateDate { get; }
Property Value
Type | Description |
---|---|
System.DateTime |
Url
Declaration
string Url { get; }
Property Value
Type | Description |
---|---|
System.String |
UrlName
Declaration
string UrlName { get; }
Property Value
Type | Description |
---|---|
System.String |
Version
Declaration
Guid Version { get; }
Property Value
Type | Description |
---|---|
System.Guid |
WriterId
Declaration
int WriterId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
WriterName
Declaration
string WriterName { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
GetIndex()
Gets the index of the published content within its current owning content set.
Declaration
int GetIndex()
Returns
Type | Description |
---|---|
System.Int32 | The index of the published content within its current owning content set. |
GetProperty(String)
Gets a property identified by its alias.
Declaration
IPublishedProperty GetProperty(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The property alias. |
Returns
Type | Description |
---|---|
IPublishedProperty | The property identified by the alias. |
Remarks
If the content type has no property with that alias, including inherited properties, returns null
,
otherwise return a property -- that may have no value (ie HasValue
is false
).
The alias is case-insensitive.
GetProperty(String, Boolean)
Gets a property identified by its alias.
Declaration
IPublishedProperty GetProperty(string alias, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The property alias. |
System.Boolean | recurse | A value indicating whether to navigate the tree upwards until a property with a value is found. |
Returns
Type | Description |
---|---|
IPublishedProperty | The property identified by the alias. |
Remarks
Navigate the tree upwards and look for a property with that alias and with a value (ie HasValue
is true
).
If found, return the property. If no property with that alias is found, having a value or not, return null
. Otherwise
return the first property that was found with the alias but had no value (ie HasValue
is false
).
The alias is case-insensitive.