Artwork.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma warning disable CA2227
  2. using System;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. using Jellyfin.Data.Enums;
  6. using Jellyfin.Data.Interfaces;
  7. namespace Jellyfin.Data.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. {
  21. if (string.IsNullOrEmpty(path))
  22. {
  23. throw new ArgumentNullException(nameof(path));
  24. }
  25. Path = path;
  26. Kind = kind;
  27. }
  28. /// <summary>
  29. /// Gets or sets the id.
  30. /// </summary>
  31. /// <remarks>
  32. /// Identity, Indexed, Required.
  33. /// </remarks>
  34. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  35. public int Id { get; protected set; }
  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. /// <summary>
  46. /// Gets or sets the kind of artwork.
  47. /// </summary>
  48. /// <remarks>
  49. /// Required.
  50. /// </remarks>
  51. public ArtKind Kind { get; set; }
  52. /// <inheritdoc />
  53. [ConcurrencyCheck]
  54. public uint RowVersion { get; set; }
  55. /// <inheritdoc />
  56. public void OnSavingChanges()
  57. {
  58. RowVersion++;
  59. }
  60. }
  61. }