Files
Umbraco-CMS/src/Umbraco.Core/Models/ContentEditing/EntityBasic.cs

71 lines
2.2 KiB
C#
Raw Normal View History

2018-06-29 19:52:40 +02:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Cms.Core.Models.Validation;
2018-06-29 19:52:40 +02:00
namespace Umbraco.Cms.Core.Models.ContentEditing
2018-06-29 19:52:40 +02:00
{
[DataContract(Name = "entity", Namespace = "")]
public class EntityBasic
{
public EntityBasic()
{
2022-04-04 10:34:13 +02:00
AdditionalData = new Dictionary<string, object?>();
2022-01-21 11:43:58 +01:00
Alias = string.Empty;
2022-02-16 16:03:53 +01:00
Path = string.Empty;
2018-06-29 19:52:40 +02:00
}
[DataMember(Name = "name", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
2022-02-16 16:03:53 +01:00
public string? Name { get; set; }
2018-06-29 19:52:40 +02:00
[DataMember(Name = "id", IsRequired = true)]
[Required]
2022-01-21 11:43:58 +01:00
public object? Id { get; set; }
2018-06-29 19:52:40 +02:00
[DataMember(Name = "udi")]
[ReadOnly(true)]
2022-01-21 11:43:58 +01:00
public Udi? Udi { get; set; }
2018-06-29 19:52:40 +02:00
[DataMember(Name = "icon")]
2022-01-21 11:43:58 +01:00
public string? Icon { get; set; }
2018-06-29 19:52:40 +02:00
[DataMember(Name = "trashed")]
[ReadOnly(true)]
public bool Trashed { get; set; }
/// <summary>
/// This is the unique Id stored in the database - but could also be the unique id for a custom membership provider
/// </summary>
[DataMember(Name = "key")]
public Guid Key { get; set; }
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// This will only be populated for some entities like macros
/// </summary>
/// <remarks>
/// It is possible to override this to specify different validation attributes if required
2018-06-29 19:52:40 +02:00
/// </remarks>
[DataMember(Name = "alias")]
public virtual string Alias { get; set; }
/// <summary>
/// The path of the entity
/// </summary>
[DataMember(Name = "path")]
2022-02-16 16:03:53 +01:00
public string Path { get; set; }
2018-06-29 19:52:40 +02:00
/// <summary>
/// A collection of extra data that is available for this specific entity/entity type
/// </summary>
[DataMember(Name = "metaData")]
[ReadOnly(true)]
2022-03-31 12:52:26 +02:00
public IDictionary<string, object?> AdditionalData { get; private set; }
2018-06-29 19:52:40 +02:00
}
}