mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
24 lines
525 B
C#
24 lines
525 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace API.Schema;
|
|
|
|
[PrimaryKey("Key")]
|
|
public abstract class Identifiable
|
|
{
|
|
protected Identifiable()
|
|
{
|
|
this.Key = TokenGen.CreateToken(this.GetType());
|
|
}
|
|
|
|
protected Identifiable(string key)
|
|
{
|
|
this.Key = key;
|
|
}
|
|
|
|
[Required]
|
|
[StringLength(TokenGen.MaximumLength, MinimumLength = TokenGen.MinimumLength)]
|
|
public string Key { get; init; }
|
|
|
|
public override string ToString() => Key;
|
|
} |