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

74 lines
1.6 KiB
C#
Raw Normal View History

2020-03-23 11:57:07 +01:00
using System;
using System.Diagnostics;
2020-03-24 23:09:29 +01:00
using zero.Core.Attributes;
2020-03-23 11:57:07 +01:00
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}")]
2020-03-24 20:30:03 +01:00
public abstract class DatabaseEntity : IDatabaseEntity
{
/// <inheritdoc/>
[GenerateId]
public string Id { get; set; }
/// <inheritdoc/>
[MapAppId]
public string AppId { get; set; }
/// <inheritdoc/>
public string Name { get; set; }
2020-04-03 16:45:47 +02:00
/// <inheritdoc/>
public string Alias { get; set; }
2020-03-24 20:30:03 +01:00
/// <inheritdoc/>
public uint Sort { get; set; }
/// <inheritdoc/>
public bool IsActive { get; set; }
/// <inheritdoc/>
public DateTimeOffset CreatedDate { get; set; }
}
public interface IDatabaseEntity
2020-03-23 11:57:07 +01:00
{
/// <summary>
/// Id of the entity
/// </summary>
2020-03-24 20:30:03 +01:00
string Id { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Id of the associated application (auto-filled)
/// </summary>
2020-03-24 20:30:03 +01:00
string AppId { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Full name of the entity
/// </summary>
2020-03-24 20:30:03 +01:00
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
/// As generating aliases from the name would not be unique we append an incremental number if the desired alias is not available anymore
/// </summary>
string Alias { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Sort order
/// </summary>
2020-03-24 20:30:03 +01:00
uint Sort { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Whether the entity is visible in the frontend
/// </summary>
2020-03-24 20:30:03 +01:00
bool IsActive { get; set; }
2020-03-23 11:57:07 +01:00
/// <summary>
/// Date of creation
/// </summary>
2020-03-24 20:30:03 +01:00
DateTimeOffset CreatedDate { get; set; }
2020-03-23 11:57:07 +01:00
}
}