| | | 1 | | using System.ComponentModel.DataAnnotations; |
| | | 2 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 3 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 4 | | |
| | | 5 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// An entity representing a genre. |
| | | 9 | | /// </summary> |
| | | 10 | | public class Genre : IHasConcurrencyToken |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Initializes a new instance of the <see cref="Genre"/> class. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="name">The name.</param> |
| | | 16 | | public Genre(string name) |
| | | 17 | | { |
| | 0 | 18 | | Name = name; |
| | 0 | 19 | | } |
| | | 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 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets or sets the name. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <remarks> |
| | | 34 | | /// Indexed, Required, Max length = 255. |
| | | 35 | | /// </remarks> |
| | | 36 | | [MaxLength(255)] |
| | | 37 | | [StringLength(255)] |
| | | 38 | | public string Name { get; set; } |
| | | 39 | | |
| | | 40 | | /// <inheritdoc /> |
| | | 41 | | [ConcurrencyCheck] |
| | | 42 | | public uint RowVersion { get; private set; } |
| | | 43 | | |
| | | 44 | | /// <inheritdoc /> |
| | | 45 | | public void OnSavingChanges() |
| | | 46 | | { |
| | 0 | 47 | | RowVersion++; |
| | 0 | 48 | | } |
| | | 49 | | } |
| | | 50 | | } |