using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Jellyfin.Data.Entities { public partial class LibraryRoot { partial void Init(); /// /// Default constructor. Protected due to required properties, but present because EF needs it. /// protected LibraryRoot() { Init(); } /// /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving. /// public static LibraryRoot CreateLibraryRootUnsafe() { return new LibraryRoot(); } /// /// Public constructor with required data /// /// Absolute Path public LibraryRoot(string path) { if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path)); this.Path = path; Init(); } /// /// Static create function (for use in LINQ queries, etc.) /// /// Absolute Path public static LibraryRoot Create(string path) { return new LibraryRoot(path); } /************************************************************************* * 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 Path /// protected string _Path; /// /// When provided in a partial class, allows value of Path to be changed before setting. /// partial void SetPath(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of Path to be changed before returning. /// partial void GetPath(ref string result); /// /// Required, Max length = 65535 /// Absolute Path /// [Required] [MaxLength(65535)] [StringLength(65535)] public string Path { get { string value = _Path; GetPath(ref value); return (_Path = value); } set { string oldValue = _Path; SetPath(oldValue, ref value); if (oldValue != value) { _Path = value; } } } /// /// Backing field for NetworkPath /// protected string _NetworkPath; /// /// When provided in a partial class, allows value of NetworkPath to be changed before setting. /// partial void SetNetworkPath(string oldValue, ref string newValue); /// /// When provided in a partial class, allows value of NetworkPath to be changed before returning. /// partial void GetNetworkPath(ref string result); /// /// Max length = 65535 /// Absolute network path, for example for transcoding sattelites. /// [MaxLength(65535)] [StringLength(65535)] public string NetworkPath { get { string value = _NetworkPath; GetNetworkPath(ref value); return (_NetworkPath = value); } set { string oldValue = _NetworkPath; SetNetworkPath(oldValue, ref value); if (oldValue != value) { _NetworkPath = value; } } } /// /// Required, ConcurrenyToken /// [ConcurrencyCheck] [Required] public uint RowVersion { get; set; } public void OnSavingChanges() { RowVersion++; } /************************************************************************* * Navigation properties *************************************************************************/ /// /// Required /// [ForeignKey("Library_Id")] public virtual Library Library { get; set; } } }