79 lines
1.7 KiB
C#
79 lines
1.7 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using zero.Core.Attributes;
|
|
|
|
namespace zero.Core.Entities
|
|
{
|
|
public interface IZeroEntity
|
|
{
|
|
string Id { get; set; }
|
|
}
|
|
|
|
[DebuggerDisplay("Id = {Id,nq}, Name = {Name}, Alias = {Alias}")]
|
|
public abstract class DatabaseEntity : IDatabaseEntity, IZeroEntity
|
|
{
|
|
/// <inheritdoc/>
|
|
[GenerateId]
|
|
public string Id { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
[MapAppId]
|
|
public string AppId { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public string Name { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public string Alias { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public uint Sort { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsActive { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public DateTimeOffset CreatedDate { get; set; }
|
|
}
|
|
|
|
|
|
public interface IDatabaseEntity
|
|
{
|
|
/// <summary>
|
|
/// Id of the entity
|
|
/// </summary>
|
|
string Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Id of the associated application (auto-filled)
|
|
/// </summary>
|
|
string AppId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Full name of the entity
|
|
/// </summary>
|
|
string Name { get; set; }
|
|
|
|
/// <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; }
|
|
|
|
/// <summary>
|
|
/// Sort order
|
|
/// </summary>
|
|
uint Sort { get; set; }
|
|
|
|
/// <summary>
|
|
/// Whether the entity is visible in the frontend
|
|
/// </summary>
|
|
bool IsActive { get; set; }
|
|
|
|
/// <summary>
|
|
/// Date of creation
|
|
/// </summary>
|
|
DateTimeOffset CreatedDate { get; set; }
|
|
}
|
|
}
|