MetadataProvider.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. ArgumentException.ThrowIfNullOrEmpty(name);
  19. Name = name;
  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 = 1024.
  34. /// </remarks>
  35. [MaxLength(1024)]
  36. [StringLength(1024)]
  37. public string Name { get; set; }
  38. /// <inheritdoc />
  39. [ConcurrencyCheck]
  40. public uint RowVersion { get; private set; }
  41. /// <inheritdoc />
  42. public void OnSavingChanges()
  43. {
  44. RowVersion++;
  45. }
  46. }
  47. }