| | 1 | | using System; |
| | 2 | | using System.ComponentModel.DataAnnotations; |
| | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | 4 | | using Jellyfin.Database.Implementations.Interfaces; |
| | 5 | |
|
| | 6 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// An entity representing a unique identifier for a metadata provider. |
| | 10 | | /// </summary> |
| | 11 | | public class MetadataProviderId : IHasConcurrencyToken |
| | 12 | | { |
| | 13 | | /// <summary> |
| | 14 | | /// Initializes a new instance of the <see cref="MetadataProviderId"/> class. |
| | 15 | | /// </summary> |
| | 16 | | /// <param name="providerId">The provider id.</param> |
| | 17 | | /// <param name="metadataProvider">The metadata provider.</param> |
| | 18 | | public MetadataProviderId(string providerId, MetadataProvider metadataProvider) |
| | 19 | | { |
| 0 | 20 | | ArgumentException.ThrowIfNullOrEmpty(providerId); |
| | 21 | |
|
| 0 | 22 | | ProviderId = providerId; |
| 0 | 23 | | MetadataProvider = metadataProvider; |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Gets the id. |
| | 28 | | /// </summary> |
| | 29 | | /// <remarks> |
| | 30 | | /// Identity, Indexed, Required. |
| | 31 | | /// </remarks> |
| | 32 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | 33 | | public int Id { get; private set; } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Gets or sets the provider id. |
| | 37 | | /// </summary> |
| | 38 | | /// <remarks> |
| | 39 | | /// Required, Max length = 255. |
| | 40 | | /// </remarks> |
| | 41 | | [MaxLength(255)] |
| | 42 | | [StringLength(255)] |
| | 43 | | public string ProviderId { get; set; } |
| | 44 | |
|
| | 45 | | /// <inheritdoc /> |
| | 46 | | [ConcurrencyCheck] |
| | 47 | | public uint RowVersion { get; private set; } |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Gets or sets the metadata provider. |
| | 51 | | /// </summary> |
| | 52 | | /// <remarks> |
| | 53 | | /// Required. |
| | 54 | | /// </remarks> |
| | 55 | | public virtual MetadataProvider MetadataProvider { get; set; } |
| | 56 | |
|
| | 57 | | /// <inheritdoc /> |
| | 58 | | public void OnSavingChanges() |
| | 59 | | { |
| 0 | 60 | | RowVersion++; |
| 0 | 61 | | } |
| | 62 | | } |
| | 63 | | } |