using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Runtime.CompilerServices; namespace Jellyfin.Data.Entities { [Table("Metadata")] public abstract partial class Metadata { partial void Init(); /// /// Default constructor. Protected due to being abstract. /// protected Metadata() { PersonRoles = new HashSet(); Genres = new HashSet(); Artwork = new HashSet(); Ratings = new HashSet(); Sources = new HashSet(); Init(); } /// /// Public constructor with required data /// /// The title or name of the object /// ISO-639-3 3-character language codes protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified) { if (string.IsNullOrEmpty(title)) throw new ArgumentNullException(nameof(title)); this.Title = title; if (string.IsNullOrEmpty(language)) throw new ArgumentNullException(nameof(language)); this.Language = language; this.PersonRoles = new HashSet(); this.Genres = new HashSet(); this.Artwork = new HashSet(); this.Ratings = new HashSet(); this.Sources = new HashSet(); Init(); } /************************************************************************* * Properties *************************************************************************/ /// /// Backing field for Id /// internal int _Id; /// /// When provided in a partial class, allows value of Id to be changed before setting. /// partial void SetId(int oldValue, ref int newValue); /// /// When provided in a partial class, allows value of Id to be changed before returning. /// partial void GetId(ref int result); /// /// Identity, Indexed, Required /// [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get { int value = _Id; GetId(ref value); return (_Id = value); } protected set { int oldValue = _Id; SetId(oldValue, ref value); if (oldValue != value) { _Id = value; } } } /// /// Backing field for Title /// protected string _Title; /// /// When provided in a partial class, allows value of Title to be changed before setting. /// partial void SetTitle(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of Title to be changed before returning. /// partial void GetTitle(ref string result); /// /// Required, Max length = 1024 /// The title or name of the object /// [Required] [MaxLength(1024)] [StringLength(1024)] public string Title { get { string value = _Title; GetTitle(ref value); return (_Title = value); } set { string oldValue = _Title; SetTitle(oldValue, ref value); if (oldValue != value) { _Title = value; } } } /// /// Backing field for OriginalTitle /// protected string _OriginalTitle; /// /// When provided in a partial class, allows value of OriginalTitle to be changed before setting. /// partial void SetOriginalTitle(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of OriginalTitle to be changed before returning. /// partial void GetOriginalTitle(ref string result); /// /// Max length = 1024 /// [MaxLength(1024)] [StringLength(1024)] public string OriginalTitle { get { string value = _OriginalTitle; GetOriginalTitle(ref value); return (_OriginalTitle = value); } set { string oldValue = _OriginalTitle; SetOriginalTitle(oldValue, ref value); if (oldValue != value) { _OriginalTitle = value; } } } /// /// Backing field for SortTitle /// protected string _SortTitle; /// /// When provided in a partial class, allows value of SortTitle to be changed before setting. /// partial void SetSortTitle(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of SortTitle to be changed before returning. /// partial void GetSortTitle(ref string result); /// /// Max length = 1024 /// [MaxLength(1024)] [StringLength(1024)] public string SortTitle { get { string value = _SortTitle; GetSortTitle(ref value); return (_SortTitle = value); } set { string oldValue = _SortTitle; SetSortTitle(oldValue, ref value); if (oldValue != value) { _SortTitle = value; } } } /// /// Backing field for Language /// protected string _Language; /// /// When provided in a partial class, allows value of Language to be changed before setting. /// partial void SetLanguage(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of Language to be changed before returning. /// partial void GetLanguage(ref string result); /// /// Required, Min length = 3, Max length = 3 /// ISO-639-3 3-character language codes /// [Required] [MinLength(3)] [MaxLength(3)] [StringLength(3)] public string Language { get { string value = _Language; GetLanguage(ref value); return (_Language = value); } set { string oldValue = _Language; SetLanguage(oldValue, ref value); if (oldValue != value) { _Language = value; } } } /// /// Backing field for ReleaseDate /// protected DateTimeOffset? _ReleaseDate; /// /// When provided in a partial class, allows value of ReleaseDate to be changed before setting. /// partial void SetReleaseDate(DateTimeOffset? oldValue, ref DateTimeOffset? newValue); /// /// When provided in a partial class, allows value of ReleaseDate to be changed before returning. /// partial void GetReleaseDate(ref DateTimeOffset? result); public DateTimeOffset? ReleaseDate { get { DateTimeOffset? value = _ReleaseDate; GetReleaseDate(ref value); return (_ReleaseDate = value); } set { DateTimeOffset? oldValue = _ReleaseDate; SetReleaseDate(oldValue, ref value); if (oldValue != value) { _ReleaseDate = value; } } } /// /// Backing field for DateAdded /// protected DateTime _DateAdded; /// /// When provided in a partial class, allows value of DateAdded to be changed before setting. /// partial void SetDateAdded(DateTime oldValue, ref DateTime newValue); /// /// When provided in a partial class, allows value of DateAdded to be changed before returning. /// partial void GetDateAdded(ref DateTime result); /// /// Required /// [Required] public DateTime DateAdded { get { DateTime value = _DateAdded; GetDateAdded(ref value); return (_DateAdded = value); } internal set { DateTime oldValue = _DateAdded; SetDateAdded(oldValue, ref value); if (oldValue != value) { _DateAdded = value; } } } /// /// Backing field for DateModified /// protected DateTime _DateModified; /// /// When provided in a partial class, allows value of DateModified to be changed before setting. /// partial void SetDateModified(DateTime oldValue, ref DateTime newValue); /// /// When provided in a partial class, allows value of DateModified to be changed before returning. /// partial void GetDateModified(ref DateTime result); /// /// Required /// [Required] public DateTime DateModified { get { DateTime value = _DateModified; GetDateModified(ref value); return (_DateModified = value); } internal set { DateTime oldValue = _DateModified; SetDateModified(oldValue, ref value); if (oldValue != value) { _DateModified = value; } } } /// /// Required, ConcurrenyToken /// [ConcurrencyCheck] [Required] public uint RowVersion { get; set; } public void OnSavingChanges() { RowVersion++; } /************************************************************************* * Navigation properties *************************************************************************/ [ForeignKey("PersonRole_PersonRoles_Id")] public virtual ICollection PersonRoles { get; protected set; } [ForeignKey("PersonRole_PersonRoles_Id")] public virtual ICollection Genres { get; protected set; } [ForeignKey("PersonRole_PersonRoles_Id")] public virtual ICollection Artwork { get; protected set; } [ForeignKey("PersonRole_PersonRoles_Id")] public virtual ICollection Ratings { get; protected set; } [ForeignKey("PersonRole_PersonRoles_Id")] public virtual ICollection Sources { get; protected set; } } }