| | | 1 | | using System; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 4 | | using Jellyfin.Database.Implementations.Enums; |
| | | 5 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 6 | | |
| | | 7 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// An entity representing artwork. |
| | | 11 | | /// </summary> |
| | | 12 | | public class Artwork : IHasConcurrencyToken |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Initializes a new instance of the <see cref="Artwork"/> class. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="path">The path.</param> |
| | | 18 | | /// <param name="kind">The kind of art.</param> |
| | | 19 | | public Artwork(string path, ArtKind kind) |
| | | 20 | | { |
| | 0 | 21 | | ArgumentException.ThrowIfNullOrEmpty(path); |
| | | 22 | | |
| | 0 | 23 | | Path = path; |
| | 0 | 24 | | Kind = kind; |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Gets the id. |
| | | 29 | | /// </summary> |
| | | 30 | | /// <remarks> |
| | | 31 | | /// Identity, Indexed, Required. |
| | | 32 | | /// </remarks> |
| | | 33 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 34 | | public int Id { get; private set; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets or sets the path. |
| | | 38 | | /// </summary> |
| | | 39 | | /// <remarks> |
| | | 40 | | /// Required, Max length = 65535. |
| | | 41 | | /// </remarks> |
| | | 42 | | [MaxLength(65535)] |
| | | 43 | | [StringLength(65535)] |
| | | 44 | | public string Path { get; set; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Gets or sets the kind of artwork. |
| | | 48 | | /// </summary> |
| | | 49 | | /// <remarks> |
| | | 50 | | /// Required. |
| | | 51 | | /// </remarks> |
| | | 52 | | public ArtKind Kind { get; set; } |
| | | 53 | | |
| | | 54 | | /// <inheritdoc /> |
| | | 55 | | [ConcurrencyCheck] |
| | | 56 | | public uint RowVersion { get; private set; } |
| | | 57 | | |
| | | 58 | | /// <inheritdoc /> |
| | | 59 | | public void OnSavingChanges() |
| | | 60 | | { |
| | 0 | 61 | | RowVersion++; |
| | 0 | 62 | | } |
| | | 63 | | } |
| | | 64 | | } |