| | | 1 | | using System; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using System.ComponentModel.DataAnnotations; |
| | | 4 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 5 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 6 | | |
| | | 7 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// An entity representing a release for a library item, eg. Director's cut vs. standard. |
| | | 11 | | /// </summary> |
| | | 12 | | public class Release : IHasConcurrencyToken |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Initializes a new instance of the <see cref="Release"/> class. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="name">The name of this release.</param> |
| | | 18 | | public Release(string name) |
| | | 19 | | { |
| | 0 | 20 | | ArgumentException.ThrowIfNullOrEmpty(name); |
| | | 21 | | |
| | 0 | 22 | | Name = name; |
| | | 23 | | |
| | 0 | 24 | | MediaFiles = new HashSet<MediaFile>(); |
| | 0 | 25 | | Chapters = new HashSet<Chapter>(); |
| | 0 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the id. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <remarks> |
| | | 32 | | /// Identity, Indexed, Required. |
| | | 33 | | /// </remarks> |
| | | 34 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 35 | | public int Id { get; private set; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets or sets the name. |
| | | 39 | | /// </summary> |
| | | 40 | | /// <remarks> |
| | | 41 | | /// Required, Max length = 1024. |
| | | 42 | | /// </remarks> |
| | | 43 | | [MaxLength(1024)] |
| | | 44 | | [StringLength(1024)] |
| | | 45 | | public string Name { get; set; } |
| | | 46 | | |
| | | 47 | | /// <inheritdoc /> |
| | | 48 | | [ConcurrencyCheck] |
| | | 49 | | public uint RowVersion { get; private set; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Gets a collection containing the media files for this release. |
| | | 53 | | /// </summary> |
| | | 54 | | public virtual ICollection<MediaFile> MediaFiles { get; private set; } |
| | | 55 | | |
| | | 56 | | /// <summary> |
| | | 57 | | /// Gets a collection containing the chapters for this release. |
| | | 58 | | /// </summary> |
| | | 59 | | public virtual ICollection<Chapter> Chapters { get; private set; } |
| | | 60 | | |
| | | 61 | | /// <inheritdoc /> |
| | | 62 | | public void OnSavingChanges() |
| | | 63 | | { |
| | 0 | 64 | | RowVersion++; |
| | 0 | 65 | | } |
| | | 66 | | } |
| | | 67 | | } |