Company.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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) throw new ArgumentNullException(nameof(_moviemetadata0));
  36. _moviemetadata0.Studios.Add(this);
  37. if (_seriesmetadata1 == null) throw new ArgumentNullException(nameof(_seriesmetadata1));
  38. _seriesmetadata1.Networks.Add(this);
  39. if (_musicalbummetadata2 == null) throw new ArgumentNullException(nameof(_musicalbummetadata2));
  40. _musicalbummetadata2.Labels.Add(this);
  41. if (_bookmetadata3 == null) throw new ArgumentNullException(nameof(_bookmetadata3));
  42. _bookmetadata3.Publishers.Add(this);
  43. if (_company4 == null) throw new ArgumentNullException(nameof(_company4));
  44. _company4.Parent = this;
  45. this.CompanyMetadata = new HashSet<CompanyMetadata>();
  46. Init();
  47. }
  48. /// <summary>
  49. /// Static create function (for use in LINQ queries, etc.)
  50. /// </summary>
  51. /// <param name="_moviemetadata0"></param>
  52. /// <param name="_seriesmetadata1"></param>
  53. /// <param name="_musicalbummetadata2"></param>
  54. /// <param name="_bookmetadata3"></param>
  55. /// <param name="_company4"></param>
  56. public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
  57. {
  58. return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
  59. }
  60. /*************************************************************************
  61. * Properties
  62. *************************************************************************/
  63. /// <summary>
  64. /// Backing field for Id
  65. /// </summary>
  66. internal int _Id;
  67. /// <summary>
  68. /// When provided in a partial class, allows value of Id to be changed before setting.
  69. /// </summary>
  70. partial void SetId(int oldValue, ref int newValue);
  71. /// <summary>
  72. /// When provided in a partial class, allows value of Id to be changed before returning.
  73. /// </summary>
  74. partial void GetId(ref int result);
  75. /// <summary>
  76. /// Identity, Indexed, Required
  77. /// </summary>
  78. [Key]
  79. [Required]
  80. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  81. public int Id
  82. {
  83. get
  84. {
  85. int value = _Id;
  86. GetId(ref value);
  87. return (_Id = value);
  88. }
  89. protected set
  90. {
  91. int oldValue = _Id;
  92. SetId(oldValue, ref value);
  93. if (oldValue != value)
  94. {
  95. _Id = value;
  96. }
  97. }
  98. }
  99. /// <summary>
  100. /// Required, ConcurrenyToken
  101. /// </summary>
  102. [ConcurrencyCheck]
  103. [Required]
  104. public uint RowVersion { get; set; }
  105. public void OnSavingChanges()
  106. {
  107. RowVersion++;
  108. }
  109. /*************************************************************************
  110. * Navigation properties
  111. *************************************************************************/
  112. [ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
  113. public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
  114. [ForeignKey("Company_Parent_Id")]
  115. public virtual Company Parent { get; set; }
  116. }
  117. }