MetadataProviderId.cs 6.3 KB

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