Genre.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 Genre
  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 Genre()
  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 Genre CreateGenreUnsafe()
  21. {
  22. return new Genre();
  23. }
  24. /// <summary>
  25. /// Public constructor with required data.
  26. /// </summary>
  27. /// <param name="name"></param>
  28. /// <param name="_metadata0"></param>
  29. public Genre(string name, Metadata _metadata0)
  30. {
  31. if (string.IsNullOrEmpty(name))
  32. {
  33. throw new ArgumentNullException(nameof(name));
  34. }
  35. this.Name = name;
  36. if (_metadata0 == null)
  37. {
  38. throw new ArgumentNullException(nameof(_metadata0));
  39. }
  40. _metadata0.Genres.Add(this);
  41. Init();
  42. }
  43. /// <summary>
  44. /// Static create function (for use in LINQ queries, etc.)
  45. /// </summary>
  46. /// <param name="name"></param>
  47. /// <param name="_metadata0"></param>
  48. public static Genre Create(string name, Metadata _metadata0)
  49. {
  50. return new Genre(name, _metadata0);
  51. }
  52. /*************************************************************************
  53. * Properties
  54. *************************************************************************/
  55. /// <summary>
  56. /// Backing field for Id.
  57. /// </summary>
  58. internal int _Id;
  59. /// <summary>
  60. /// When provided in a partial class, allows value of Id to be changed before setting.
  61. /// </summary>
  62. partial void SetId(int oldValue, ref int newValue);
  63. /// <summary>
  64. /// When provided in a partial class, allows value of Id to be changed before returning.
  65. /// </summary>
  66. partial void GetId(ref int result);
  67. /// <summary>
  68. /// Identity, Indexed, Required.
  69. /// </summary>
  70. [Key]
  71. [Required]
  72. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  73. public int Id
  74. {
  75. get
  76. {
  77. int value = _Id;
  78. GetId(ref value);
  79. return _Id = value;
  80. }
  81. protected set
  82. {
  83. int oldValue = _Id;
  84. SetId(oldValue, ref value);
  85. if (oldValue != value)
  86. {
  87. _Id = value;
  88. }
  89. }
  90. }
  91. /// <summary>
  92. /// Backing field for Name.
  93. /// </summary>
  94. internal string _Name;
  95. /// <summary>
  96. /// When provided in a partial class, allows value of Name to be changed before setting.
  97. /// </summary>
  98. partial void SetName(string oldValue, ref string newValue);
  99. /// <summary>
  100. /// When provided in a partial class, allows value of Name to be changed before returning.
  101. /// </summary>
  102. partial void GetName(ref string result);
  103. /// <summary>
  104. /// Indexed, Required, Max length = 255
  105. /// </summary>
  106. [Required]
  107. [MaxLength(255)]
  108. [StringLength(255)]
  109. public string Name
  110. {
  111. get
  112. {
  113. string value = _Name;
  114. GetName(ref value);
  115. return _Name = value;
  116. }
  117. set
  118. {
  119. string oldValue = _Name;
  120. SetName(oldValue, ref value);
  121. if (oldValue != value)
  122. {
  123. _Name = value;
  124. }
  125. }
  126. }
  127. /// <summary>
  128. /// Required, ConcurrenyToken.
  129. /// </summary>
  130. [ConcurrencyCheck]
  131. [Required]
  132. public uint RowVersion { get; set; }
  133. public void OnSavingChanges()
  134. {
  135. RowVersion++;
  136. }
  137. /*************************************************************************
  138. * Navigation properties
  139. *************************************************************************/
  140. }
  141. }