| | | 1 | | using System.Collections.Generic; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 4 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 5 | | |
| | | 6 | | namespace Jellyfin.Database.Implementations.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 | | { |
| | 0 | 18 | | CompanyMetadata = new HashSet<CompanyMetadata>(); |
| | 0 | 19 | | ChildCompanies = new HashSet<Company>(); |
| | 0 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets the id. |
| | | 24 | | /// </summary> |
| | | 25 | | /// <remarks> |
| | | 26 | | /// Identity, Indexed, Required. |
| | | 27 | | /// </remarks> |
| | | 28 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 29 | | public int Id { get; private set; } |
| | | 30 | | |
| | | 31 | | /// <inheritdoc /> |
| | | 32 | | [ConcurrencyCheck] |
| | | 33 | | public uint RowVersion { get; private set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Gets a collection containing the metadata. |
| | | 37 | | /// </summary> |
| | | 38 | | public virtual ICollection<CompanyMetadata> CompanyMetadata { get; private set; } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Gets a collection containing this company's child companies. |
| | | 42 | | /// </summary> |
| | | 43 | | public virtual ICollection<Company> ChildCompanies { get; private set; } |
| | | 44 | | |
| | | 45 | | /// <inheritdoc /> |
| | 0 | 46 | | public ICollection<Company> Companies => ChildCompanies; |
| | | 47 | | |
| | | 48 | | /// <inheritdoc /> |
| | | 49 | | public void OnSavingChanges() |
| | | 50 | | { |
| | 0 | 51 | | RowVersion++; |
| | 0 | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |