Library.cs 1.6 KB

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