MetadataProviderId.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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)) throw new ArgumentNullException(nameof(providerid));
  38. this.ProviderId = providerid;
  39. if (_metadata0 == null) throw new ArgumentNullException(nameof(_metadata0));
  40. _metadata0.Sources.Add(this);
  41. if (_person1 == null) throw new ArgumentNullException(nameof(_person1));
  42. _person1.Sources.Add(this);
  43. if (_personrole2 == null) throw new ArgumentNullException(nameof(_personrole2));
  44. _personrole2.Sources.Add(this);
  45. if (_ratingsource3 == null) throw new ArgumentNullException(nameof(_ratingsource3));
  46. _ratingsource3.Source = this;
  47. Init();
  48. }
  49. /// <summary>
  50. /// Static create function (for use in LINQ queries, etc.)
  51. /// </summary>
  52. /// <param name="providerid"></param>
  53. /// <param name="_metadata0"></param>
  54. /// <param name="_person1"></param>
  55. /// <param name="_personrole2"></param>
  56. /// <param name="_ratingsource3"></param>
  57. public static MetadataProviderId Create(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
  58. {
  59. return new MetadataProviderId(providerid, _metadata0, _person1, _personrole2, _ratingsource3);
  60. }
  61. /*************************************************************************
  62. * Properties
  63. *************************************************************************/
  64. /// <summary>
  65. /// Backing field for Id
  66. /// </summary>
  67. internal int _Id;
  68. /// <summary>
  69. /// When provided in a partial class, allows value of Id to be changed before setting.
  70. /// </summary>
  71. partial void SetId(int oldValue, ref int newValue);
  72. /// <summary>
  73. /// When provided in a partial class, allows value of Id to be changed before returning.
  74. /// </summary>
  75. partial void GetId(ref int result);
  76. /// <summary>
  77. /// Identity, Indexed, Required
  78. /// </summary>
  79. [Key]
  80. [Required]
  81. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  82. public int Id
  83. {
  84. get
  85. {
  86. int value = _Id;
  87. GetId(ref value);
  88. return (_Id = value);
  89. }
  90. protected set
  91. {
  92. int oldValue = _Id;
  93. SetId(oldValue, ref value);
  94. if (oldValue != value)
  95. {
  96. _Id = value;
  97. }
  98. }
  99. }
  100. /// <summary>
  101. /// Backing field for ProviderId
  102. /// </summary>
  103. protected string _ProviderId;
  104. /// <summary>
  105. /// When provided in a partial class, allows value of ProviderId to be changed before setting.
  106. /// </summary>
  107. partial void SetProviderId(string oldValue, ref string newValue);
  108. /// <summary>
  109. /// When provided in a partial class, allows value of ProviderId to be changed before returning.
  110. /// </summary>
  111. partial void GetProviderId(ref string result);
  112. /// <summary>
  113. /// Required, Max length = 255
  114. /// </summary>
  115. [Required]
  116. [MaxLength(255)]
  117. [StringLength(255)]
  118. public string ProviderId
  119. {
  120. get
  121. {
  122. string value = _ProviderId;
  123. GetProviderId(ref value);
  124. return (_ProviderId = value);
  125. }
  126. set
  127. {
  128. string oldValue = _ProviderId;
  129. SetProviderId(oldValue, ref value);
  130. if (oldValue != value)
  131. {
  132. _ProviderId = value;
  133. }
  134. }
  135. }
  136. /// <summary>
  137. /// Required, ConcurrenyToken
  138. /// </summary>
  139. [ConcurrencyCheck]
  140. [Required]
  141. public uint RowVersion { get; set; }
  142. public void OnSavingChanges()
  143. {
  144. RowVersion++;
  145. }
  146. /*************************************************************************
  147. * Navigation properties
  148. *************************************************************************/
  149. /// <summary>
  150. /// Required
  151. /// </summary>
  152. [ForeignKey("MetadataProvider_Id")]
  153. public virtual MetadataProvider MetadataProvider { get; set; }
  154. }
  155. }