Files
mixtape/zero.Core/Entities/ZeroEntity.cs
T

101 lines
2.4 KiB
C#
Raw Normal View History

2021-02-08 15:45:25 +01:00
using Newtonsoft.Json;
using System;
2020-03-23 11:57:07 +01:00
using System.Diagnostics;
2020-03-24 23:09:29 +01:00
namespace zero.Core.Entities
2020-03-23 11:57:07 +01:00
{
2020-04-03 16:45:47 +02:00
[DebuggerDisplay("Id = {Id,nq}, Name = {Name}, Alias = {Alias}")]
2021-10-05 15:50:12 +02:00
public class ZeroEntity : ZeroIdEntity, IZeroDbConventions, IZeroRouteEntity
2020-03-23 11:57:07 +01:00
{
/// <summary>
/// Full name of the entity
/// </summary>
2021-05-04 17:23:52 +02:00
public string Name { get; set; }
2020-03-23 11:57:07 +01:00
2020-04-03 16:45:47 +02:00
/// <summary>
/// Unique alias which can be used in the frontend and URLs
/// </summary>
2021-05-04 17:23:52 +02:00
public string Alias { get; set; }
2020-04-03 16:45:47 +02:00
2021-03-02 16:16:29 +01:00
/// <summary>
/// A key which can be used to query this entity in code
/// </summary>
2021-05-04 17:23:52 +02:00
public string Key { get; set; }
2021-03-02 16:16:29 +01:00
2020-03-23 11:57:07 +01:00
/// <summary>
/// Sort order
/// </summary>
2021-05-04 17:23:52 +02:00
public uint Sort { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Whether the entity is visible in the frontend
/// </summary>
2021-05-04 17:23:52 +02:00
public bool IsActive { get; set; }
2020-03-23 11:57:07 +01:00
2020-10-23 15:50:59 +02:00
/// <summary>
/// Unique hash for this entity (primarily used for routing)
/// </summary>
2021-05-04 17:23:52 +02:00
public string Hash { get; set; }
2020-10-23 15:50:59 +02:00
/// <summary>
/// Backoffice user who last modified this content
/// </summary>
2020-10-12 13:14:23 +02:00
public string LastModifiedById { get; set; }
2020-09-17 13:25:09 +02:00
/// <summary>
/// Date of last modification
/// </summary>
2021-05-04 17:23:52 +02:00
public DateTimeOffset LastModifiedDate { get; set; }
2020-09-17 13:25:09 +02:00
/// <summary>
/// Backoffice user who created this content
/// </summary>
2020-10-12 13:14:23 +02:00
public string CreatedById { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Date of creation
/// </summary>
2021-05-04 17:23:52 +02:00
public DateTimeOffset CreatedDate { get; set; }
2020-09-17 13:08:16 +02:00
/// <summary>
2020-10-05 18:01:28 +02:00
/// Configuration of the base entity (which this one inherits from)
2020-09-17 13:08:16 +02:00
/// </summary>
2021-05-04 17:23:52 +02:00
public BlueprintConfiguration Blueprint { get; set; }
/// <summary>
/// Language of the entity
/// </summary>
public string LanguageId { get; set; }
2021-02-08 15:45:25 +01:00
/// <summary>
/// [Warning] This field is always empty when bound to the database.
/// It is only filled in the app-code for routing.
/// </summary>
[JsonIgnore]
public string Url { get; set; }
2020-03-23 11:57:07 +01:00
}
2021-05-04 17:23:52 +02:00
2021-05-14 13:19:10 +02:00
public class ZeroIdEntity
2021-05-04 17:23:52 +02:00
{
/// <summary>
/// Id of the entity
/// </summary>
public string Id { get; set; }
}
2021-10-05 15:50:12 +02:00
public interface IZeroRouteEntity
{
/// <summary>
/// Id of the entity
/// </summary>
string Id { get; set; }
/// <summary>
/// Unique hash for this entity (primarily used for routing)
/// </summary>
string Hash { get; set; }
}
2020-03-23 11:57:07 +01:00
}