using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Jellyfin.Data.Entities { public partial class MediaFile { partial void Init(); /// /// Default constructor. Protected due to required properties, but present because EF needs it. /// protected MediaFile() { MediaFileStreams = new HashSet(); Init(); } /// /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving. /// public static MediaFile CreateMediaFileUnsafe() { return new MediaFile(); } /// /// Public constructor with required data /// /// Relative to the LibraryRoot /// /// public MediaFile(string path, Enums.MediaFileKind kind, Release _release0) { if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path)); this.Path = path; this.Kind = kind; if (_release0 == null) throw new ArgumentNullException(nameof(_release0)); _release0.MediaFiles.Add(this); this.MediaFileStreams = new HashSet(); Init(); } /// /// Static create function (for use in LINQ queries, etc.) /// /// Relative to the LibraryRoot /// /// public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0) { return new MediaFile(path, kind, _release0); } /************************************************************************* * 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 /// Relative to the LibraryRoot /// [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 Kind /// protected Enums.MediaFileKind _Kind; /// /// When provided in a partial class, allows value of Kind to be changed before setting. /// partial void SetKind(Enums.MediaFileKind oldValue, ref Enums.MediaFileKind newValue); /// /// When provided in a partial class, allows value of Kind to be changed before returning. /// partial void GetKind(ref Enums.MediaFileKind result); /// /// Required /// [Required] public Enums.MediaFileKind Kind { get { Enums.MediaFileKind value = _Kind; GetKind(ref value); return (_Kind = value); } set { Enums.MediaFileKind oldValue = _Kind; SetKind(oldValue, ref value); if (oldValue != value) { _Kind = value; } } } /// /// Required, ConcurrenyToken /// [ConcurrencyCheck] [Required] public uint RowVersion { get; set; } public void OnSavingChanges() { RowVersion++; } /************************************************************************* * Navigation properties *************************************************************************/ [ForeignKey("MediaFileStream_MediaFileStreams_Id")] public virtual ICollection MediaFileStreams { get; protected set; } } }