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

74 lines
2.3 KiB
C#
Raw Normal View History

2013-09-02 15:40:14 +02:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
2013-09-02 15:40:14 +02:00
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
2017-05-12 14:49:44 +02:00
using Newtonsoft.Json;
using Umbraco.Core;
2013-09-02 15:40:14 +02:00
using Umbraco.Core.Models.Validation;
2017-05-12 14:49:44 +02:00
using Umbraco.Core.Serialization;
2013-09-02 15:40:14 +02:00
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "entity", Namespace = "")]
public class EntityBasic
{
public EntityBasic()
{
AdditionalData = new Dictionary<string, object>();
}
2013-09-02 15:40:14 +02:00
[DataMember(Name = "name", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Name { get; set; }
[DataMember(Name = "id", IsRequired = true)]
[Required]
public object Id { get; set; }
2017-05-12 14:49:44 +02:00
[DataMember(Name = "udi")]
[ReadOnly(true)]
[JsonConverter(typeof(UdiJsonConverter))]
public Udi Udi { get; set; }
2013-09-02 15:40:14 +02:00
[DataMember(Name = "icon")]
public string Icon { get; set; }
[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>
2013-10-10 13:33:25 +02:00
[DataMember(Name = "key")]
public Guid Key { get; set; }
2013-09-02 15:40:14 +02:00
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// This will only be populated for some entities like macros
/// </summary>
/// <remarks>
/// This is overrideable to specify different validation attributes if required
/// </remarks>
[DataMember(Name = "alias")]
public virtual string Alias { get; set; }
/// <summary>
/// The path of the entity
/// </summary>
[DataMember(Name = "path")]
public string Path { get; set; }
2017-07-20 11:21:28 +02:00
/// <summary>
/// A collection of extra data that is available for this specific entity/entity type
/// </summary>
[DataMember(Name = "metaData")]
[ReadOnly(true)]
2017-07-20 11:21:28 +02:00
public IDictionary<string, object> AdditionalData { get; private set; }
2013-09-02 15:40:14 +02:00
}
}