41 lines
960 B
C#
41 lines
960 B
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Lactose.Models;
|
|
/// <summary>
|
|
/// Represents a tag entity with a unique identifier, name, and optional parent tag.
|
|
/// </summary>
|
|
public class Tag {
|
|
/// <summary>
|
|
/// Gets or sets the unique identifier for the tag.
|
|
/// </summary>
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the name of the tag.
|
|
/// </summary>
|
|
[Column(TypeName = "VARCHAR(255)")]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the unique identifier of the parent tag, if any.
|
|
/// </summary>
|
|
[ForeignKey(nameof(Parent))]
|
|
public Guid? ParentId { get; set; }
|
|
|
|
#region Navigation Properties
|
|
|
|
/// <summary>
|
|
/// Gets or sets the parent tag.
|
|
/// </summary>
|
|
public Tag? Parent { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the list of assets associated with the tag.
|
|
/// </summary>
|
|
public List<Asset>? Assets { get; set; }
|
|
|
|
#endregion
|
|
}
|