IW4M-Admin/Data/Models/EFMeta.cs

40 lines
1.2 KiB
C#
Raw Normal View History

using Data.Models.Client;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Data.Models
{
/// <summary>
/// This class encapsulates any meta fields as a simple string
/// </summary>
public class EFMeta : SharedEntity
{
2022-03-23 09:43:57 -04:00
public const string ClientTagNameV2 = nameof(ClientTagNameV2);
public const string ClientTagV2 = nameof(ClientTagV2);
[Key]
public int MetaId { get; set; }
[Required]
public DateTime Created { get; set; } = DateTime.UtcNow;
[Required]
public DateTime Updated { get; set; } = DateTime.UtcNow;
public int? ClientId { get; set; }
// this is the client that the meta could belong to
[ForeignKey(nameof(ClientId))]
public virtual EFClient Client { get; set; }
[Required]
[MinLength(3)]
2019-02-22 20:35:03 -05:00
[StringLength(32)]
[MaxLength(32)]
public string Key { get; set; }
[Required]
public string Value { get; set; }
public string Extra { get; set; }
public int? LinkedMetaId { get; set; }
[ForeignKey(nameof(LinkedMetaId))]
public virtual EFMeta LinkedMeta { get; set; }
}
}