2
0

Release.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. namespace Jellyfin.Data.Entities
  6. {
  7. public partial class Release
  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 Release()
  14. {
  15. MediaFiles = new HashSet<MediaFile>();
  16. Chapters = new HashSet<Chapter>();
  17. Init();
  18. }
  19. /// <summary>
  20. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  21. /// </summary>
  22. public static Release CreateReleaseUnsafe()
  23. {
  24. return new Release();
  25. }
  26. /// <summary>
  27. /// Public constructor with required data
  28. /// </summary>
  29. /// <param name="name"></param>
  30. /// <param name="_movie0"></param>
  31. /// <param name="_episode1"></param>
  32. /// <param name="_track2"></param>
  33. /// <param name="_customitem3"></param>
  34. /// <param name="_book4"></param>
  35. /// <param name="_photo5"></param>
  36. public Release(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
  37. {
  38. if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name));
  39. this.Name = name;
  40. if (_movie0 == null) throw new ArgumentNullException(nameof(_movie0));
  41. _movie0.Releases.Add(this);
  42. if (_episode1 == null) throw new ArgumentNullException(nameof(_episode1));
  43. _episode1.Releases.Add(this);
  44. if (_track2 == null) throw new ArgumentNullException(nameof(_track2));
  45. _track2.Releases.Add(this);
  46. if (_customitem3 == null) throw new ArgumentNullException(nameof(_customitem3));
  47. _customitem3.Releases.Add(this);
  48. if (_book4 == null) throw new ArgumentNullException(nameof(_book4));
  49. _book4.Releases.Add(this);
  50. if (_photo5 == null) throw new ArgumentNullException(nameof(_photo5));
  51. _photo5.Releases.Add(this);
  52. this.MediaFiles = new HashSet<MediaFile>();
  53. this.Chapters = new HashSet<Chapter>();
  54. Init();
  55. }
  56. /// <summary>
  57. /// Static create function (for use in LINQ queries, etc.)
  58. /// </summary>
  59. /// <param name="name"></param>
  60. /// <param name="_movie0"></param>
  61. /// <param name="_episode1"></param>
  62. /// <param name="_track2"></param>
  63. /// <param name="_customitem3"></param>
  64. /// <param name="_book4"></param>
  65. /// <param name="_photo5"></param>
  66. public static Release Create(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
  67. {
  68. return new Release(name, _movie0, _episode1, _track2, _customitem3, _book4, _photo5);
  69. }
  70. /*************************************************************************
  71. * Properties
  72. *************************************************************************/
  73. /// <summary>
  74. /// Backing field for Id
  75. /// </summary>
  76. internal int _Id;
  77. /// <summary>
  78. /// When provided in a partial class, allows value of Id to be changed before setting.
  79. /// </summary>
  80. partial void SetId(int oldValue, ref int newValue);
  81. /// <summary>
  82. /// When provided in a partial class, allows value of Id to be changed before returning.
  83. /// </summary>
  84. partial void GetId(ref int result);
  85. /// <summary>
  86. /// Identity, Indexed, Required
  87. /// </summary>
  88. [Key]
  89. [Required]
  90. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  91. public int Id
  92. {
  93. get
  94. {
  95. int value = _Id;
  96. GetId(ref value);
  97. return (_Id = value);
  98. }
  99. protected set
  100. {
  101. int oldValue = _Id;
  102. SetId(oldValue, ref value);
  103. if (oldValue != value)
  104. {
  105. _Id = value;
  106. }
  107. }
  108. }
  109. /// <summary>
  110. /// Backing field for Name
  111. /// </summary>
  112. protected string _Name;
  113. /// <summary>
  114. /// When provided in a partial class, allows value of Name to be changed before setting.
  115. /// </summary>
  116. partial void SetName(string oldValue, ref string newValue);
  117. /// <summary>
  118. /// When provided in a partial class, allows value of Name to be changed before returning.
  119. /// </summary>
  120. partial void GetName(ref string result);
  121. /// <summary>
  122. /// Required, Max length = 1024
  123. /// </summary>
  124. [Required]
  125. [MaxLength(1024)]
  126. [StringLength(1024)]
  127. public string Name
  128. {
  129. get
  130. {
  131. string value = _Name;
  132. GetName(ref value);
  133. return (_Name = value);
  134. }
  135. set
  136. {
  137. string oldValue = _Name;
  138. SetName(oldValue, ref value);
  139. if (oldValue != value)
  140. {
  141. _Name = value;
  142. }
  143. }
  144. }
  145. /// <summary>
  146. /// Required, ConcurrenyToken
  147. /// </summary>
  148. [ConcurrencyCheck]
  149. [Required]
  150. public uint RowVersion { get; set; }
  151. public void OnSavingChanges()
  152. {
  153. RowVersion++;
  154. }
  155. /*************************************************************************
  156. * Navigation properties
  157. *************************************************************************/
  158. [ForeignKey("MediaFile_MediaFiles_Id")]
  159. public virtual ICollection<MediaFile> MediaFiles { get; protected set; }
  160. [ForeignKey("Chapter_Chapters_Id")]
  161. public virtual ICollection<Chapter> Chapters { get; protected set; }
  162. }
  163. }