Artwork.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. ArgumentException.ThrowIfNullOrEmpty(path);
  21. Path = path;
  22. Kind = kind;
  23. }
  24. /// <summary>
  25. /// Gets the id.
  26. /// </summary>
  27. /// <remarks>
  28. /// Identity, Indexed, Required.
  29. /// </remarks>
  30. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  31. public int Id { get; private set; }
  32. /// <summary>
  33. /// Gets or sets the path.
  34. /// </summary>
  35. /// <remarks>
  36. /// Required, Max length = 65535.
  37. /// </remarks>
  38. [MaxLength(65535)]
  39. [StringLength(65535)]
  40. public string Path { get; set; }
  41. /// <summary>
  42. /// Gets or sets the kind of artwork.
  43. /// </summary>
  44. /// <remarks>
  45. /// Required.
  46. /// </remarks>
  47. public ArtKind Kind { get; set; }
  48. /// <inheritdoc />
  49. [ConcurrencyCheck]
  50. public uint RowVersion { get; private set; }
  51. /// <inheritdoc />
  52. public void OnSavingChanges()
  53. {
  54. RowVersion++;
  55. }
  56. }
  57. }