Company.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #pragma warning disable CA2227
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using Jellyfin.Data.Interfaces;
  6. namespace Jellyfin.Data.Entities.Libraries
  7. {
  8. /// <summary>
  9. /// An entity representing a company.
  10. /// </summary>
  11. public class Company : IHasCompanies, IHasConcurrencyToken
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="Company"/> class.
  15. /// </summary>
  16. public Company()
  17. {
  18. CompanyMetadata = new HashSet<CompanyMetadata>();
  19. ChildCompanies = new HashSet<Company>();
  20. }
  21. /// <summary>
  22. /// Gets or sets the id.
  23. /// </summary>
  24. /// <remarks>
  25. /// Identity, Indexed, Required.
  26. /// </remarks>
  27. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  28. public int Id { get; protected set; }
  29. /// <inheritdoc />
  30. [ConcurrencyCheck]
  31. public uint RowVersion { get; set; }
  32. /// <summary>
  33. /// Gets or sets a collection containing the metadata.
  34. /// </summary>
  35. public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
  36. /// <summary>
  37. /// Gets or sets a collection containing this company's child companies.
  38. /// </summary>
  39. public virtual ICollection<Company> ChildCompanies { get; protected set; }
  40. /// <inheritdoc />
  41. public ICollection<Company> Companies => ChildCompanies;
  42. /// <inheritdoc />
  43. public void OnSavingChanges()
  44. {
  45. RowVersion++;
  46. }
  47. }
  48. }