Company.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. namespace Jellyfin.Data.Entities
  6. {
  7. public partial class Company
  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 Company()
  14. {
  15. CompanyMetadata = new HashSet<CompanyMetadata>();
  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 Company CreateCompanyUnsafe()
  22. {
  23. return new Company();
  24. }
  25. /// <summary>
  26. /// Public constructor with required data.
  27. /// </summary>
  28. /// <param name="_moviemetadata0"></param>
  29. /// <param name="_seriesmetadata1"></param>
  30. /// <param name="_musicalbummetadata2"></param>
  31. /// <param name="_bookmetadata3"></param>
  32. /// <param name="_company4"></param>
  33. public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
  34. {
  35. if (_moviemetadata0 == null)
  36. {
  37. throw new ArgumentNullException(nameof(_moviemetadata0));
  38. }
  39. _moviemetadata0.Studios.Add(this);
  40. if (_seriesmetadata1 == null)
  41. {
  42. throw new ArgumentNullException(nameof(_seriesmetadata1));
  43. }
  44. _seriesmetadata1.Networks.Add(this);
  45. if (_musicalbummetadata2 == null)
  46. {
  47. throw new ArgumentNullException(nameof(_musicalbummetadata2));
  48. }
  49. _musicalbummetadata2.Labels.Add(this);
  50. if (_bookmetadata3 == null)
  51. {
  52. throw new ArgumentNullException(nameof(_bookmetadata3));
  53. }
  54. _bookmetadata3.Publishers.Add(this);
  55. if (_company4 == null)
  56. {
  57. throw new ArgumentNullException(nameof(_company4));
  58. }
  59. _company4.Parent = this;
  60. this.CompanyMetadata = new HashSet<CompanyMetadata>();
  61. Init();
  62. }
  63. /// <summary>
  64. /// Static create function (for use in LINQ queries, etc.)
  65. /// </summary>
  66. /// <param name="_moviemetadata0"></param>
  67. /// <param name="_seriesmetadata1"></param>
  68. /// <param name="_musicalbummetadata2"></param>
  69. /// <param name="_bookmetadata3"></param>
  70. /// <param name="_company4"></param>
  71. public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
  72. {
  73. return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
  74. }
  75. /*************************************************************************
  76. * Properties
  77. *************************************************************************/
  78. /// <summary>
  79. /// Backing field for Id.
  80. /// </summary>
  81. internal int _Id;
  82. /// <summary>
  83. /// When provided in a partial class, allows value of Id to be changed before setting.
  84. /// </summary>
  85. partial void SetId(int oldValue, ref int newValue);
  86. /// <summary>
  87. /// When provided in a partial class, allows value of Id to be changed before returning.
  88. /// </summary>
  89. partial void GetId(ref int result);
  90. /// <summary>
  91. /// Identity, Indexed, Required.
  92. /// </summary>
  93. [Key]
  94. [Required]
  95. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  96. public int Id
  97. {
  98. get
  99. {
  100. int value = _Id;
  101. GetId(ref value);
  102. return _Id = value;
  103. }
  104. protected set
  105. {
  106. int oldValue = _Id;
  107. SetId(oldValue, ref value);
  108. if (oldValue != value)
  109. {
  110. _Id = value;
  111. }
  112. }
  113. }
  114. /// <summary>
  115. /// Required, ConcurrenyToken.
  116. /// </summary>
  117. [ConcurrencyCheck]
  118. [Required]
  119. public uint RowVersion { get; set; }
  120. public void OnSavingChanges()
  121. {
  122. RowVersion++;
  123. }
  124. /*************************************************************************
  125. * Navigation properties
  126. *************************************************************************/
  127. [ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
  128. public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
  129. [ForeignKey("Company_Parent_Id")]
  130. public virtual Company Parent { get; set; }
  131. }
  132. }