MetadataProvider.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. using Jellyfin.Data.Interfaces;
  5. namespace Jellyfin.Data.Entities.Libraries
  6. {
  7. /// <summary>
  8. /// An entity representing a metadata provider.
  9. /// </summary>
  10. public class MetadataProvider : IHasConcurrencyToken
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="MetadataProvider"/> class.
  14. /// </summary>
  15. /// <param name="name">The name of the metadata provider.</param>
  16. public MetadataProvider(string name)
  17. {
  18. if (string.IsNullOrEmpty(name))
  19. {
  20. throw new ArgumentNullException(nameof(name));
  21. }
  22. Name = name;
  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 name.
  34. /// </summary>
  35. /// <remarks>
  36. /// Required, Max length = 1024.
  37. /// </remarks>
  38. [MaxLength(1024)]
  39. [StringLength(1024)]
  40. public string Name { get; set; }
  41. /// <inheritdoc />
  42. [ConcurrencyCheck]
  43. public uint RowVersion { get; private set; }
  44. /// <inheritdoc />
  45. public void OnSavingChanges()
  46. {
  47. RowVersion++;
  48. }
  49. }
  50. }