Artwork.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. using Jellyfin.Data.Enums;
  5. using Jellyfin.Data.Interfaces;
  6. namespace Jellyfin.Data.Entities.Libraries
  7. {
  8. /// <summary>
  9. /// An entity representing artwork.
  10. /// </summary>
  11. public class Artwork : IHasConcurrencyToken
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="Artwork"/> class.
  15. /// </summary>
  16. /// <param name="path">The path.</param>
  17. /// <param name="kind">The kind of art.</param>
  18. public Artwork(string path, ArtKind kind)
  19. {
  20. if (string.IsNullOrEmpty(path))
  21. {
  22. throw new ArgumentNullException(nameof(path));
  23. }
  24. Path = path;
  25. Kind = kind;
  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. /// <summary>
  36. /// Gets or sets the path.
  37. /// </summary>
  38. /// <remarks>
  39. /// Required, Max length = 65535.
  40. /// </remarks>
  41. [MaxLength(65535)]
  42. [StringLength(65535)]
  43. public string Path { get; set; }
  44. /// <summary>
  45. /// Gets or sets the kind of artwork.
  46. /// </summary>
  47. /// <remarks>
  48. /// Required.
  49. /// </remarks>
  50. public ArtKind Kind { get; set; }
  51. /// <inheritdoc />
  52. [ConcurrencyCheck]
  53. public uint RowVersion { get; private set; }
  54. /// <inheritdoc />
  55. public void OnSavingChanges()
  56. {
  57. RowVersion++;
  58. }
  59. }
  60. }