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

131 lines
5.3 KiB
C#
Raw Normal View History

2018-06-29 19:52:40 +02:00
using System;
using System.Collections.Generic;
using Umbraco.Cms.Core.Models.Entities;
2018-06-29 19:52:40 +02:00
namespace Umbraco.Cms.Core.Models
2018-06-29 19:52:40 +02:00
{
Merge commit '94d525d88f713b36419f28bfda4d82ee68637d83' into v9/dev # Conflicts: # build/NuSpecs/UmbracoCms.Web.nuspec # src/Umbraco.Core/Composing/Current.cs # src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs # src/Umbraco.Core/Runtime/CoreRuntime.cs # src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs # src/Umbraco.Infrastructure/Persistence/NPocoDatabaseExtensions.cs # src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs # src/Umbraco.Persistence.SqlCe/SqlCeSyntaxProvider.cs # src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentCacheDataModel.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentCacheDataSerializationResult.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentCacheDataSerializerEntityType.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentData.cs # src/Umbraco.PublishedCache.NuCache/DataSource/ContentNestedData.cs # src/Umbraco.PublishedCache.NuCache/DataSource/CultureVariation.cs # src/Umbraco.PublishedCache.NuCache/DataSource/IContentCacheDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/DataSource/IContentCacheDataSerializerFactory.cs # src/Umbraco.PublishedCache.NuCache/DataSource/IDictionaryOfPropertyDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/DataSource/JsonContentNestedDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/DataSource/JsonContentNestedDataSerializerFactory.cs # src/Umbraco.PublishedCache.NuCache/DataSource/LazyCompressedString.cs # src/Umbraco.PublishedCache.NuCache/DataSource/MsgPackContentNestedDataSerializer.cs # src/Umbraco.PublishedCache.NuCache/DataSource/MsgPackContentNestedDataSerializerFactory.cs # src/Umbraco.PublishedCache.NuCache/DataSource/PropertyData.cs # src/Umbraco.PublishedCache.NuCache/NuCacheSerializerComponent.cs # src/Umbraco.PublishedCache.NuCache/NuCacheSerializerComposer.cs # src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs # src/Umbraco.Tests/App.config # src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs # src/Umbraco.Tests/PublishedContent/NuCacheTests.cs # src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web.UI/web.Template.Debug.config # src/Umbraco.Web.UI/web.Template.config # src/Umbraco.Web/Composing/ModuleInjector.cs # src/Umbraco.Web/Editors/NuCacheStatusController.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/ContentNestedData.cs # src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs # src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs # src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs # src/Umbraco.Web/Runtime/WebRuntime.cs
2021-06-24 09:43:57 -06:00
2018-06-29 19:52:40 +02:00
/// <summary>
/// Provides a base class for content items.
/// </summary>
/// <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, IRememberBeingDirty
2018-06-29 19:52:40 +02:00
{
/// <summary>
/// Integer Id of the default ContentType
/// </summary>
int ContentTypeId { get; }
2019-02-05 14:06:48 +01:00
/// <summary>
/// Gets the content type of this content.
/// </summary>
ISimpleContentType ContentType { get; }
2018-06-29 19:52:40 +02:00
/// <summary>
/// Gets the identifier of the writer.
/// </summary>
int WriterId { get; set; }
/// <summary>
/// Gets the version identifier.
/// </summary>
int VersionId { get; set; }
2018-06-29 19:52:40 +02:00
/// <summary>
2018-06-20 14:18:57 +02:00
/// Sets the name of the content item for a specified culture.
2018-06-29 19:52:40 +02:00
/// </summary>
/// <remarks>
2018-06-20 14:18:57 +02:00
/// <para>When <paramref name="culture"/> is null, sets the invariant
/// culture name, which sets the <see cref="TreeEntityBase.Name"/> property.</para>
/// <para>When <paramref name="culture"/> is not null, throws if the content
/// type does not vary by culture.</para>
2018-06-29 19:52:40 +02:00
/// </remarks>
2018-06-20 14:18:57 +02:00
void SetCultureName(string value, string culture);
2018-06-29 19:52:40 +02:00
/// <summary>
/// Gets the name of the content item for a specified language.
/// </summary>
/// <remarks>
2018-06-20 14:18:57 +02:00
/// <para>When <paramref name="culture"/> is null, gets the invariant
/// culture name, which is the value of the <see cref="TreeEntityBase.Name"/> property.</para>
/// <para>When <paramref name="culture"/> is not null, and the content type
/// does not vary by culture, returns null.</para>
2018-06-29 19:52:40 +02:00
/// </remarks>
2018-06-20 14:18:57 +02:00
string GetCultureName(string culture);
2018-04-12 22:53:04 +02:00
2018-06-29 19:52:40 +02:00
/// <summary>
2018-10-23 15:04:41 +02:00
/// Gets culture infos of the content item.
2018-06-29 19:52:40 +02:00
/// </summary>
/// <remarks>
2018-06-20 14:18:57 +02:00
/// <para>Because a dictionary key cannot be <c>null</c> this cannot contain the invariant
/// culture name, which must be get or set via the <see cref="TreeEntityBase.Name"/> property.</para>
2018-06-29 19:52:40 +02:00
/// </remarks>
ContentCultureInfosCollection CultureInfos { get; set; }
2019-02-06 17:28:48 +01:00
2018-06-20 14:18:57 +02:00
/// <summary>
/// Gets the available cultures.
/// </summary>
/// <remarks>
/// <para>Cannot contain the invariant culture, which is always available.</para>
/// </remarks>
IEnumerable<string> AvailableCultures { get; }
2018-06-29 19:52:40 +02: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>
2018-06-20 14:18:57 +02:00
/// <para>Returns <c>false</c> for the invariant culture, in order to be consistent
/// with <seealso cref="AvailableCultures"/>, even though the invariant culture is
/// always available.</para>
2018-11-15 13:25:21 +01:00
/// <para>Does not support the '*' wildcard (returns false).</para>
2018-06-29 19:52:40 +02:00
/// </remarks>
bool IsCultureAvailable(string culture);
/// <summary>
2018-09-25 18:05:14 +02:00
/// Gets the date a culture was updated.
2018-06-29 19:52:40 +02:00
/// </summary>
2018-06-20 14:18:57 +02:00
/// <remarks>
/// <para>When <paramref name="culture" /> is <c>null</c>, returns <c>null</c>.</para>
/// <para>If the specified culture is not available, returns <c>null</c>.</para>
/// </remarks>
2018-09-25 18:05:14 +02:00
DateTime? GetUpdateDate(string culture);
2018-06-29 19:52:40 +02:00
/// <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>
IPropertyCollection Properties { get; set; }
2018-06-29 19:52:40 +02:00
/// <summary>
/// Gets a value indicating whether the content entity has a property with the supplied alias.
/// </summary>
/// <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>
/// Gets the value of a Property
/// </summary>
2018-06-22 21:03:47 +02:00
/// <remarks>Values 'null' and 'empty' are equivalent for culture and segment.</remarks>
2018-06-29 19:52:40 +02:00
object GetValue(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
/// <summary>
/// Gets the typed value of a Property
/// </summary>
2018-06-22 21:03:47 +02:00
/// <remarks>Values 'null' and 'empty' are equivalent for culture and segment.</remarks>
2018-06-29 19:52:40 +02:00
TValue GetValue<TValue>(string propertyTypeAlias, string culture = null, string segment = null, bool published = false);
/// <summary>
/// Sets the (edited) value of a Property
/// </summary>
2018-06-22 21:03:47 +02:00
/// <remarks>Values 'null' and 'empty' are equivalent for culture and segment.</remarks>
2018-06-29 19:52:40 +02:00
void SetValue(string propertyTypeAlias, object value, string culture = null, string segment = null);
}
}