MediaFile.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated from a template.
  4. //
  5. // Manual changes to this file may cause unexpected behavior in your application.
  6. // Manual changes to this file will be overwritten if the code is regenerated.
  7. //
  8. // Produced by Entity Framework Visual Editor
  9. // https://github.com/msawczyn/EFDesigner
  10. // </auto-generated>
  11. //------------------------------------------------------------------------------
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Collections.ObjectModel;
  15. using System.ComponentModel;
  16. using System.ComponentModel.DataAnnotations;
  17. using System.ComponentModel.DataAnnotations.Schema;
  18. using System.Linq;
  19. using System.Runtime.CompilerServices;
  20. namespace Jellyfin.Data.Entities
  21. {
  22. public partial class MediaFile
  23. {
  24. partial void Init();
  25. /// <summary>
  26. /// Default constructor. Protected due to required properties, but present because EF needs it.
  27. /// </summary>
  28. protected MediaFile()
  29. {
  30. MediaFileStreams = new System.Collections.Generic.HashSet<global::Jellyfin.Data.Entities.MediaFileStream>();
  31. Init();
  32. }
  33. /// <summary>
  34. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  35. /// </summary>
  36. public static MediaFile CreateMediaFileUnsafe()
  37. {
  38. return new MediaFile();
  39. }
  40. /// <summary>
  41. /// Public constructor with required data
  42. /// </summary>
  43. /// <param name="path">Relative to the LibraryRoot</param>
  44. /// <param name="kind"></param>
  45. /// <param name="_release0"></param>
  46. public MediaFile(string path, global::Jellyfin.Data.Enums.MediaFileKind kind, global::Jellyfin.Data.Entities.Release _release0)
  47. {
  48. if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
  49. this.Path = path;
  50. this.Kind = kind;
  51. if (_release0 == null) throw new ArgumentNullException(nameof(_release0));
  52. _release0.MediaFiles.Add(this);
  53. this.MediaFileStreams = new System.Collections.Generic.HashSet<global::Jellyfin.Data.Entities.MediaFileStream>();
  54. Init();
  55. }
  56. /// <summary>
  57. /// Static create function (for use in LINQ queries, etc.)
  58. /// </summary>
  59. /// <param name="path">Relative to the LibraryRoot</param>
  60. /// <param name="kind"></param>
  61. /// <param name="_release0"></param>
  62. public static MediaFile Create(string path, global::Jellyfin.Data.Enums.MediaFileKind kind, global::Jellyfin.Data.Entities.Release _release0)
  63. {
  64. return new MediaFile(path, kind, _release0);
  65. }
  66. /*************************************************************************
  67. * Properties
  68. *************************************************************************/
  69. /// <summary>
  70. /// Backing field for Id
  71. /// </summary>
  72. internal int _Id;
  73. /// <summary>
  74. /// When provided in a partial class, allows value of Id to be changed before setting.
  75. /// </summary>
  76. partial void SetId(int oldValue, ref int newValue);
  77. /// <summary>
  78. /// When provided in a partial class, allows value of Id to be changed before returning.
  79. /// </summary>
  80. partial void GetId(ref int result);
  81. /// <summary>
  82. /// Identity, Indexed, Required
  83. /// </summary>
  84. [Key]
  85. [Required]
  86. public int Id
  87. {
  88. get
  89. {
  90. int value = _Id;
  91. GetId(ref value);
  92. return (_Id = value);
  93. }
  94. protected set
  95. {
  96. int oldValue = _Id;
  97. SetId(oldValue, ref value);
  98. if (oldValue != value)
  99. {
  100. _Id = value;
  101. }
  102. }
  103. }
  104. /// <summary>
  105. /// Backing field for Path
  106. /// </summary>
  107. protected string _Path;
  108. /// <summary>
  109. /// When provided in a partial class, allows value of Path to be changed before setting.
  110. /// </summary>
  111. partial void SetPath(string oldValue, ref string newValue);
  112. /// <summary>
  113. /// When provided in a partial class, allows value of Path to be changed before returning.
  114. /// </summary>
  115. partial void GetPath(ref string result);
  116. /// <summary>
  117. /// Required, Max length = 65535
  118. /// Relative to the LibraryRoot
  119. /// </summary>
  120. [Required]
  121. [MaxLength(65535)]
  122. [StringLength(65535)]
  123. public string Path
  124. {
  125. get
  126. {
  127. string value = _Path;
  128. GetPath(ref value);
  129. return (_Path = value);
  130. }
  131. set
  132. {
  133. string oldValue = _Path;
  134. SetPath(oldValue, ref value);
  135. if (oldValue != value)
  136. {
  137. _Path = value;
  138. }
  139. }
  140. }
  141. /// <summary>
  142. /// Backing field for Kind
  143. /// </summary>
  144. protected global::Jellyfin.Data.Enums.MediaFileKind _Kind;
  145. /// <summary>
  146. /// When provided in a partial class, allows value of Kind to be changed before setting.
  147. /// </summary>
  148. partial void SetKind(global::Jellyfin.Data.Enums.MediaFileKind oldValue, ref global::Jellyfin.Data.Enums.MediaFileKind newValue);
  149. /// <summary>
  150. /// When provided in a partial class, allows value of Kind to be changed before returning.
  151. /// </summary>
  152. partial void GetKind(ref global::Jellyfin.Data.Enums.MediaFileKind result);
  153. /// <summary>
  154. /// Required
  155. /// </summary>
  156. [Required]
  157. public global::Jellyfin.Data.Enums.MediaFileKind Kind
  158. {
  159. get
  160. {
  161. global::Jellyfin.Data.Enums.MediaFileKind value = _Kind;
  162. GetKind(ref value);
  163. return (_Kind = value);
  164. }
  165. set
  166. {
  167. global::Jellyfin.Data.Enums.MediaFileKind oldValue = _Kind;
  168. SetKind(oldValue, ref value);
  169. if (oldValue != value)
  170. {
  171. _Kind = value;
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// Required
  177. /// </summary>
  178. [ConcurrencyCheck]
  179. [Required]
  180. public byte[] Timestamp { get; set; }
  181. /*************************************************************************
  182. * Navigation properties
  183. *************************************************************************/
  184. public virtual ICollection<global::Jellyfin.Data.Entities.MediaFileStream> MediaFileStreams { get; protected set; }
  185. }
  186. }