MetadataProviderId.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. namespace Jellyfin.Data.Entities
  5. {
  6. public partial class MetadataProviderId
  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 MetadataProviderId()
  13. {
  14. // NOTE: This class has one-to-one associations with MetadataProviderId.
  15. // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
  16. Init();
  17. }
  18. /// <summary>
  19. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  20. /// </summary>
  21. public static MetadataProviderId CreateMetadataProviderIdUnsafe()
  22. {
  23. return new MetadataProviderId();
  24. }
  25. /// <summary>
  26. /// Public constructor with required data.
  27. /// </summary>
  28. /// <param name="providerid"></param>
  29. /// <param name="_metadata0"></param>
  30. /// <param name="_person1"></param>
  31. /// <param name="_personrole2"></param>
  32. /// <param name="_ratingsource3"></param>
  33. public MetadataProviderId(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
  34. {
  35. // NOTE: This class has one-to-one associations with MetadataProviderId.
  36. // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
  37. if (string.IsNullOrEmpty(providerid))
  38. {
  39. throw new ArgumentNullException(nameof(providerid));
  40. }
  41. this.ProviderId = providerid;
  42. if (_metadata0 == null)
  43. {
  44. throw new ArgumentNullException(nameof(_metadata0));
  45. }
  46. _metadata0.Sources.Add(this);
  47. if (_person1 == null)
  48. {
  49. throw new ArgumentNullException(nameof(_person1));
  50. }
  51. _person1.Sources.Add(this);
  52. if (_personrole2 == null)
  53. {
  54. throw new ArgumentNullException(nameof(_personrole2));
  55. }
  56. _personrole2.Sources.Add(this);
  57. if (_ratingsource3 == null)
  58. {
  59. throw new ArgumentNullException(nameof(_ratingsource3));
  60. }
  61. _ratingsource3.Source = this;
  62. Init();
  63. }
  64. /// <summary>
  65. /// Static create function (for use in LINQ queries, etc.)
  66. /// </summary>
  67. /// <param name="providerid"></param>
  68. /// <param name="_metadata0"></param>
  69. /// <param name="_person1"></param>
  70. /// <param name="_personrole2"></param>
  71. /// <param name="_ratingsource3"></param>
  72. public static MetadataProviderId Create(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
  73. {
  74. return new MetadataProviderId(providerid, _metadata0, _person1, _personrole2, _ratingsource3);
  75. }
  76. /*************************************************************************
  77. * Properties
  78. *************************************************************************/
  79. /// <summary>
  80. /// Backing field for Id.
  81. /// </summary>
  82. internal int _Id;
  83. /// <summary>
  84. /// When provided in a partial class, allows value of Id to be changed before setting.
  85. /// </summary>
  86. partial void SetId(int oldValue, ref int newValue);
  87. /// <summary>
  88. /// When provided in a partial class, allows value of Id to be changed before returning.
  89. /// </summary>
  90. partial void GetId(ref int result);
  91. /// <summary>
  92. /// Identity, Indexed, Required.
  93. /// </summary>
  94. [Key]
  95. [Required]
  96. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  97. public int Id
  98. {
  99. get
  100. {
  101. int value = _Id;
  102. GetId(ref value);
  103. return _Id = value;
  104. }
  105. protected set
  106. {
  107. int oldValue = _Id;
  108. SetId(oldValue, ref value);
  109. if (oldValue != value)
  110. {
  111. _Id = value;
  112. }
  113. }
  114. }
  115. /// <summary>
  116. /// Backing field for ProviderId.
  117. /// </summary>
  118. protected string _ProviderId;
  119. /// <summary>
  120. /// When provided in a partial class, allows value of ProviderId to be changed before setting.
  121. /// </summary>
  122. partial void SetProviderId(string oldValue, ref string newValue);
  123. /// <summary>
  124. /// When provided in a partial class, allows value of ProviderId to be changed before returning.
  125. /// </summary>
  126. partial void GetProviderId(ref string result);
  127. /// <summary>
  128. /// Required, Max length = 255
  129. /// </summary>
  130. [Required]
  131. [MaxLength(255)]
  132. [StringLength(255)]
  133. public string ProviderId
  134. {
  135. get
  136. {
  137. string value = _ProviderId;
  138. GetProviderId(ref value);
  139. return _ProviderId = value;
  140. }
  141. set
  142. {
  143. string oldValue = _ProviderId;
  144. SetProviderId(oldValue, ref value);
  145. if (oldValue != value)
  146. {
  147. _ProviderId = value;
  148. }
  149. }
  150. }
  151. /// <summary>
  152. /// Required, ConcurrenyToken.
  153. /// </summary>
  154. [ConcurrencyCheck]
  155. [Required]
  156. public uint RowVersion { get; set; }
  157. public void OnSavingChanges()
  158. {
  159. RowVersion++;
  160. }
  161. /*************************************************************************
  162. * Navigation properties
  163. *************************************************************************/
  164. /// <summary>
  165. /// Required.
  166. /// </summary>
  167. [ForeignKey("MetadataProvider_Id")]
  168. public virtual MetadataProvider MetadataProvider { get; set; }
  169. }
  170. }