LibraryRoot.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. namespace Jellyfin.Data.Entities
  5. {
  6. public partial class LibraryRoot
  7. {
  8. partial void Init();
  9. /// <summary>
  10. /// Default constructor. Protected due to required properties, but present because EF needs it.
  11. /// </summary>
  12. protected LibraryRoot()
  13. {
  14. Init();
  15. }
  16. /// <summary>
  17. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  18. /// </summary>
  19. public static LibraryRoot CreateLibraryRootUnsafe()
  20. {
  21. return new LibraryRoot();
  22. }
  23. /// <summary>
  24. /// Public constructor with required data.
  25. /// </summary>
  26. /// <param name="path">Absolute Path.</param>
  27. public LibraryRoot(string path)
  28. {
  29. if (string.IsNullOrEmpty(path))
  30. {
  31. throw new ArgumentNullException(nameof(path));
  32. }
  33. this.Path = path;
  34. Init();
  35. }
  36. /// <summary>
  37. /// Static create function (for use in LINQ queries, etc.)
  38. /// </summary>
  39. /// <param name="path">Absolute Path.</param>
  40. public static LibraryRoot Create(string path)
  41. {
  42. return new LibraryRoot(path);
  43. }
  44. /*************************************************************************
  45. * Properties
  46. *************************************************************************/
  47. /// <summary>
  48. /// Backing field for Id.
  49. /// </summary>
  50. internal int _Id;
  51. /// <summary>
  52. /// When provided in a partial class, allows value of Id to be changed before setting.
  53. /// </summary>
  54. partial void SetId(int oldValue, ref int newValue);
  55. /// <summary>
  56. /// When provided in a partial class, allows value of Id to be changed before returning.
  57. /// </summary>
  58. partial void GetId(ref int result);
  59. /// <summary>
  60. /// Identity, Indexed, Required.
  61. /// </summary>
  62. [Key]
  63. [Required]
  64. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  65. public int Id
  66. {
  67. get
  68. {
  69. int value = _Id;
  70. GetId(ref value);
  71. return _Id = value;
  72. }
  73. protected set
  74. {
  75. int oldValue = _Id;
  76. SetId(oldValue, ref value);
  77. if (oldValue != value)
  78. {
  79. _Id = value;
  80. }
  81. }
  82. }
  83. /// <summary>
  84. /// Backing field for Path.
  85. /// </summary>
  86. protected string _Path;
  87. /// <summary>
  88. /// When provided in a partial class, allows value of Path to be changed before setting.
  89. /// </summary>
  90. partial void SetPath(string oldValue, ref string newValue);
  91. /// <summary>
  92. /// When provided in a partial class, allows value of Path to be changed before returning.
  93. /// </summary>
  94. partial void GetPath(ref string result);
  95. /// <summary>
  96. /// Required, Max length = 65535
  97. /// Absolute Path.
  98. /// </summary>
  99. [Required]
  100. [MaxLength(65535)]
  101. [StringLength(65535)]
  102. public string Path
  103. {
  104. get
  105. {
  106. string value = _Path;
  107. GetPath(ref value);
  108. return _Path = value;
  109. }
  110. set
  111. {
  112. string oldValue = _Path;
  113. SetPath(oldValue, ref value);
  114. if (oldValue != value)
  115. {
  116. _Path = value;
  117. }
  118. }
  119. }
  120. /// <summary>
  121. /// Backing field for NetworkPath.
  122. /// </summary>
  123. protected string _NetworkPath;
  124. /// <summary>
  125. /// When provided in a partial class, allows value of NetworkPath to be changed before setting.
  126. /// </summary>
  127. partial void SetNetworkPath(string oldValue, ref string newValue);
  128. /// <summary>
  129. /// When provided in a partial class, allows value of NetworkPath to be changed before returning.
  130. /// </summary>
  131. partial void GetNetworkPath(ref string result);
  132. /// <summary>
  133. /// Max length = 65535
  134. /// Absolute network path, for example for transcoding sattelites.
  135. /// </summary>
  136. [MaxLength(65535)]
  137. [StringLength(65535)]
  138. public string NetworkPath
  139. {
  140. get
  141. {
  142. string value = _NetworkPath;
  143. GetNetworkPath(ref value);
  144. return _NetworkPath = value;
  145. }
  146. set
  147. {
  148. string oldValue = _NetworkPath;
  149. SetNetworkPath(oldValue, ref value);
  150. if (oldValue != value)
  151. {
  152. _NetworkPath = value;
  153. }
  154. }
  155. }
  156. /// <summary>
  157. /// Required, ConcurrenyToken.
  158. /// </summary>
  159. [ConcurrencyCheck]
  160. [Required]
  161. public uint RowVersion { get; set; }
  162. public void OnSavingChanges()
  163. {
  164. RowVersion++;
  165. }
  166. /*************************************************************************
  167. * Navigation properties
  168. *************************************************************************/
  169. /// <summary>
  170. /// Required.
  171. /// </summary>
  172. [ForeignKey("Library_Id")]
  173. public virtual Library Library { get; set; }
  174. }
  175. }