Genre.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 genre.
  8. /// </summary>
  9. public class Genre : IHasConcurrencyToken
  10. {
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="Genre"/> class.
  13. /// </summary>
  14. /// <param name="name">The name.</param>
  15. public Genre(string name)
  16. {
  17. Name = name;
  18. }
  19. /// <summary>
  20. /// Gets the id.
  21. /// </summary>
  22. /// <remarks>
  23. /// Identity, Indexed, Required.
  24. /// </remarks>
  25. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  26. public int Id { get; private set; }
  27. /// <summary>
  28. /// Gets or sets the name.
  29. /// </summary>
  30. /// <remarks>
  31. /// Indexed, Required, Max length = 255.
  32. /// </remarks>
  33. [MaxLength(255)]
  34. [StringLength(255)]
  35. public string Name { get; set; }
  36. /// <inheritdoc />
  37. [ConcurrencyCheck]
  38. public uint RowVersion { get; private set; }
  39. /// <inheritdoc />
  40. public void OnSavingChanges()
  41. {
  42. RowVersion++;
  43. }
  44. }
  45. }