LibraryRoot.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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)) throw new ArgumentNullException(nameof(path));
  30. this.Path = path;
  31. Init();
  32. }
  33. /// <summary>
  34. /// Static create function (for use in LINQ queries, etc.)
  35. /// </summary>
  36. /// <param name="path">Absolute Path</param>
  37. public static LibraryRoot Create(string path)
  38. {
  39. return new LibraryRoot(path);
  40. }
  41. /*************************************************************************
  42. * Properties
  43. *************************************************************************/
  44. /// <summary>
  45. /// Backing field for Id
  46. /// </summary>
  47. internal int _Id;
  48. /// <summary>
  49. /// When provided in a partial class, allows value of Id to be changed before setting.
  50. /// </summary>
  51. partial void SetId(int oldValue, ref int newValue);
  52. /// <summary>
  53. /// When provided in a partial class, allows value of Id to be changed before returning.
  54. /// </summary>
  55. partial void GetId(ref int result);
  56. /// <summary>
  57. /// Identity, Indexed, Required
  58. /// </summary>
  59. [Key]
  60. [Required]
  61. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  62. public int Id
  63. {
  64. get
  65. {
  66. int value = _Id;
  67. GetId(ref value);
  68. return (_Id = value);
  69. }
  70. protected set
  71. {
  72. int oldValue = _Id;
  73. SetId(oldValue, ref value);
  74. if (oldValue != value)
  75. {
  76. _Id = value;
  77. }
  78. }
  79. }
  80. /// <summary>
  81. /// Backing field for Path
  82. /// </summary>
  83. protected string _Path;
  84. /// <summary>
  85. /// When provided in a partial class, allows value of Path to be changed before setting.
  86. /// </summary>
  87. partial void SetPath(string oldValue, ref string newValue);
  88. /// <summary>
  89. /// When provided in a partial class, allows value of Path to be changed before returning.
  90. /// </summary>
  91. partial void GetPath(ref string result);
  92. /// <summary>
  93. /// Required, Max length = 65535
  94. /// Absolute Path
  95. /// </summary>
  96. [Required]
  97. [MaxLength(65535)]
  98. [StringLength(65535)]
  99. public string Path
  100. {
  101. get
  102. {
  103. string value = _Path;
  104. GetPath(ref value);
  105. return (_Path = value);
  106. }
  107. set
  108. {
  109. string oldValue = _Path;
  110. SetPath(oldValue, ref value);
  111. if (oldValue != value)
  112. {
  113. _Path = value;
  114. }
  115. }
  116. }
  117. /// <summary>
  118. /// Backing field for NetworkPath
  119. /// </summary>
  120. protected string _NetworkPath;
  121. /// <summary>
  122. /// When provided in a partial class, allows value of NetworkPath to be changed before setting.
  123. /// </summary>
  124. partial void SetNetworkPath(string oldValue, ref string newValue);
  125. /// <summary>
  126. /// When provided in a partial class, allows value of NetworkPath to be changed before returning.
  127. /// </summary>
  128. partial void GetNetworkPath(ref string result);
  129. /// <summary>
  130. /// Max length = 65535
  131. /// Absolute network path, for example for transcoding sattelites.
  132. /// </summary>
  133. [MaxLength(65535)]
  134. [StringLength(65535)]
  135. public string NetworkPath
  136. {
  137. get
  138. {
  139. string value = _NetworkPath;
  140. GetNetworkPath(ref value);
  141. return (_NetworkPath = value);
  142. }
  143. set
  144. {
  145. string oldValue = _NetworkPath;
  146. SetNetworkPath(oldValue, ref value);
  147. if (oldValue != value)
  148. {
  149. _NetworkPath = value;
  150. }
  151. }
  152. }
  153. /// <summary>
  154. /// Required, ConcurrenyToken
  155. /// </summary>
  156. [ConcurrencyCheck]
  157. [Required]
  158. public uint RowVersion { get; set; }
  159. public void OnSavingChanges()
  160. {
  161. RowVersion++;
  162. }
  163. /*************************************************************************
  164. * Navigation properties
  165. *************************************************************************/
  166. /// <summary>
  167. /// Required
  168. /// </summary>
  169. [ForeignKey("Library_Id")]
  170. public virtual Library Library { get; set; }
  171. }
  172. }