Company.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.ComponentModel.DataAnnotations.Schema;
  6. namespace Jellyfin.Data.Entities
  7. {
  8. public partial class Company
  9. {
  10. partial void Init();
  11. /// <summary>
  12. /// Default constructor. Protected due to required properties, but present because EF needs it.
  13. /// </summary>
  14. protected Company()
  15. {
  16. CompanyMetadata = new HashSet<CompanyMetadata>();
  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 Company CreateCompanyUnsafe()
  23. {
  24. return new Company();
  25. }
  26. /// <summary>
  27. /// Public constructor with required data.
  28. /// </summary>
  29. /// <param name="_moviemetadata0"></param>
  30. /// <param name="_seriesmetadata1"></param>
  31. /// <param name="_musicalbummetadata2"></param>
  32. /// <param name="_bookmetadata3"></param>
  33. /// <param name="_company4"></param>
  34. public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
  35. {
  36. if (_moviemetadata0 == null)
  37. {
  38. throw new ArgumentNullException(nameof(_moviemetadata0));
  39. }
  40. _moviemetadata0.Studios.Add(this);
  41. if (_seriesmetadata1 == null)
  42. {
  43. throw new ArgumentNullException(nameof(_seriesmetadata1));
  44. }
  45. _seriesmetadata1.Networks.Add(this);
  46. if (_musicalbummetadata2 == null)
  47. {
  48. throw new ArgumentNullException(nameof(_musicalbummetadata2));
  49. }
  50. _musicalbummetadata2.Labels.Add(this);
  51. if (_bookmetadata3 == null)
  52. {
  53. throw new ArgumentNullException(nameof(_bookmetadata3));
  54. }
  55. _bookmetadata3.Publishers.Add(this);
  56. if (_company4 == null)
  57. {
  58. throw new ArgumentNullException(nameof(_company4));
  59. }
  60. _company4.Parent = this;
  61. this.CompanyMetadata = new HashSet<CompanyMetadata>();
  62. Init();
  63. }
  64. /// <summary>
  65. /// Static create function (for use in LINQ queries, etc.)
  66. /// </summary>
  67. /// <param name="_moviemetadata0"></param>
  68. /// <param name="_seriesmetadata1"></param>
  69. /// <param name="_musicalbummetadata2"></param>
  70. /// <param name="_bookmetadata3"></param>
  71. /// <param name="_company4"></param>
  72. public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
  73. {
  74. return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
  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. /// Required, ConcurrenyToken.
  117. /// </summary>
  118. [ConcurrencyCheck]
  119. [Required]
  120. public uint RowVersion { get; set; }
  121. public void OnSavingChanges()
  122. {
  123. RowVersion++;
  124. }
  125. /*************************************************************************
  126. * Navigation properties
  127. *************************************************************************/
  128. [ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
  129. public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
  130. [ForeignKey("Company_Parent_Id")]
  131. public virtual Company Parent { get; set; }
  132. }
  133. }