LibraryRoot.cs 5.7 KB

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