| | | 1 | | #pragma warning disable CA1711 // Identifiers should not have incorrect suffix |
| | | 2 | | |
| | | 3 | | using System.Collections.Generic; |
| | | 4 | | using System.ComponentModel.DataAnnotations; |
| | | 5 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 6 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 7 | | |
| | | 8 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// An entity representing a collection. |
| | | 12 | | /// </summary> |
| | | 13 | | public class Collection : IHasConcurrencyToken |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Initializes a new instance of the <see cref="Collection"/> class. |
| | | 17 | | /// </summary> |
| | | 18 | | public Collection() |
| | | 19 | | { |
| | 0 | 20 | | Items = new HashSet<CollectionItem>(); |
| | 0 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the id. |
| | | 25 | | /// </summary> |
| | | 26 | | /// <remarks> |
| | | 27 | | /// Identity, Indexed, Required. |
| | | 28 | | /// </remarks> |
| | | 29 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 30 | | public int Id { get; private set; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets or sets the name. |
| | | 34 | | /// </summary> |
| | | 35 | | /// <remarks> |
| | | 36 | | /// Max length = 1024. |
| | | 37 | | /// </remarks> |
| | | 38 | | [MaxLength(1024)] |
| | | 39 | | [StringLength(1024)] |
| | | 40 | | public string? Name { get; set; } |
| | | 41 | | |
| | | 42 | | /// <inheritdoc /> |
| | | 43 | | [ConcurrencyCheck] |
| | | 44 | | public uint RowVersion { get; private set; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets a collection containing this collection's items. |
| | | 48 | | /// </summary> |
| | | 49 | | public virtual ICollection<CollectionItem> Items { get; private set; } |
| | | 50 | | |
| | | 51 | | /// <inheritdoc /> |
| | | 52 | | public void OnSavingChanges() |
| | | 53 | | { |
| | 0 | 54 | | RowVersion++; |
| | 0 | 55 | | } |
| | | 56 | | } |
| | | 57 | | } |