Files
Umbraco-CMS/src/Umbraco.Core/Models/IContentBase.cs

128 lines
5.0 KiB
C#
Raw Normal View History

2018-04-28 21:57:07 +02:00
using System;
using System.Collections.Generic;
using Umbraco.Core.Models.Entities;
namespace Umbraco.Core.Models
{
/// <summary>
2018-04-12 22:53:04 +02:00
/// Provides a base class for content items.
/// </summary>
2018-04-12 22:53:04 +02:00
/// <remarks>
/// <para>Content items are documents, medias and members.</para>
/// <para>Content items have a content type, and properties.</para>
/// </remarks>
public interface IContentBase : IUmbracoEntity
{
/// <summary>
/// Integer Id of the default ContentType
/// </summary>
int ContentTypeId { get; }
/// <summary>
2017-12-01 19:29:54 +01:00
/// Gets the identifier of the writer.
/// </summary>
2017-12-01 19:29:54 +01:00
int WriterId { get; set; }
2017-11-10 11:27:12 +01:00
/// <summary>
2017-12-01 19:29:54 +01:00
/// Gets the version identifier.
2017-11-10 11:27:12 +01:00
/// </summary>
2017-12-01 19:29:54 +01:00
int VersionId { get; }
2018-04-12 22:53:04 +02:00
/// <summary>
/// Sets the name of the content item for a specified language.
/// </summary>
/// <remarks>
2018-04-21 09:57:28 +02:00
/// <para>When <paramref name="culture"/> is <c>null</c>, sets the invariant
2018-04-12 22:53:04 +02:00
/// language, which sets the <see cref="TreeEntityBase.Name"/> property.</para>
/// </remarks>
2018-04-21 09:57:28 +02:00
void SetName(string culture, string value);
2018-04-12 22:53:04 +02:00
/// <summary>
/// Gets the name of the content item for a specified language.
/// </summary>
/// <remarks>
2018-04-21 09:57:28 +02:00
/// <para>When <paramref name="culture"/> is <c>null</c>, gets the invariant
2018-04-12 22:53:04 +02:00
/// language, which is the value of the <see cref="TreeEntityBase.Name"/> property.</para>
/// </remarks>
2018-04-21 09:57:28 +02:00
string GetName(string culture);
2018-04-12 22:53:04 +02:00
/// <summary>
2018-04-28 21:57:07 +02:00
/// Gets the names of the content item.
2018-04-12 22:53:04 +02:00
/// </summary>
/// <remarks>
2018-04-28 21:57:07 +02:00
/// <para>Because a dictionary key cannot be <c>null</c> this cannot get the invariant
2018-04-12 22:53:04 +02:00
/// name, which must be get or set via the <see cref="TreeEntityBase.Name"/> property.</para>
/// </remarks>
2018-04-28 21:57:07 +02:00
IReadOnlyDictionary<string, string> Names { get; }
2017-11-10 11:27:12 +01:00
/// <summary>
/// Gets a value indicating whether a given culture is available.
/// </summary>
/// <remarks>
/// <para>A culture becomes available whenever the content name for this culture is
/// non-null, and it becomes unavailable whenever the content name is null.</para>
/// </remarks>
bool IsCultureAvailable(string culture);
2018-04-28 21:57:07 +02:00
/// <summary>
/// Gets the date a culture was created.
/// </summary>
DateTime GetCultureDate(string culture);
/// <summary>
/// List of properties, which make up all the data available for this Content object
/// </summary>
/// <remarks>Properties are loaded as part of the Content object graph</remarks>
PropertyCollection Properties { get; set; }
/// <summary>
/// List of PropertyGroups available on this Content object
/// </summary>
/// <remarks>PropertyGroups are kind of lazy loaded as part of the object graph</remarks>
IEnumerable<PropertyGroup> PropertyGroups { get; }
/// <summary>
/// List of PropertyTypes available on this Content object
/// </summary>
/// <remarks>PropertyTypes are kind of lazy loaded as part of the object graph</remarks>
IEnumerable<PropertyType> PropertyTypes { get; }
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets a value indicating whether the content entity has a property with the supplied alias.
/// </summary>
2017-11-30 13:56:29 +01:00
/// <remarks>Indicates that the content entity has a property with the supplied alias, but
/// not necessarily that the content has a value for that property. Could be missing.</remarks>
bool HasProperty(string propertyTypeAlias);
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets the value of a Property
/// </summary>
2018-04-21 09:57:28 +02:00
object GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets the typed value of a Property
/// </summary>
2018-04-21 09:57:28 +02:00
TValue GetValue<TValue>(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
/// <summary>
2017-11-30 13:56:29 +01:00
/// Sets the (edited) value of a Property
/// </summary>
2018-04-21 09:57:28 +02:00
void SetValue(string propertyTypeAlias, object value, string culture = null, string segment = null);
2017-11-23 16:30:04 +01:00
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets a value indicating whether the content and all its properties values are valid.
2017-11-23 16:30:04 +01:00
/// </summary>
2017-11-30 13:56:29 +01:00
Property[] ValidateAll();
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets a value indicating whether the content and its properties values are valid.
/// </summary>
2018-04-21 09:57:28 +02:00
Property[] Validate(string culture = null, string segment = null);
/// <summary>
2017-11-30 13:56:29 +01:00
/// Gets a value indicating whether the content and its culture/any properties values are valid.
/// </summary>
2018-04-21 09:57:28 +02:00
Property[] ValidateCulture(string culture = null);
}
2017-07-20 11:21:28 +02:00
}