| | | 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 collection item. |
| | | 9 | | /// </summary> |
| | | 10 | | public class CollectionItem : IHasConcurrencyToken |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Initializes a new instance of the <see cref="CollectionItem"/> class. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="libraryItem">The library item.</param> |
| | | 16 | | public CollectionItem(LibraryItem libraryItem) |
| | | 17 | | { |
| | 0 | 18 | | LibraryItem = libraryItem; |
| | 0 | 19 | | } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets or sets the id. |
| | | 23 | | /// </summary> |
| | | 24 | | /// <remarks> |
| | | 25 | | /// Identity, Indexed, Required. |
| | | 26 | | /// </remarks> |
| | | 27 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 28 | | public int Id { get; set; } |
| | | 29 | | |
| | | 30 | | /// <inheritdoc /> |
| | | 31 | | [ConcurrencyCheck] |
| | | 32 | | public uint RowVersion { get; private set; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets the library item. |
| | | 36 | | /// </summary> |
| | | 37 | | /// <remarks> |
| | | 38 | | /// Required. |
| | | 39 | | /// </remarks> |
| | | 40 | | public virtual LibraryItem LibraryItem { get; set; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Gets or sets the next item in the collection. |
| | | 44 | | /// </summary> |
| | | 45 | | /// <remarks> |
| | | 46 | | /// TODO check if this properly updated Dependent and has the proper principal relationship. |
| | | 47 | | /// </remarks> |
| | | 48 | | public virtual CollectionItem? Next { get; set; } |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// Gets or sets the previous item in the collection. |
| | | 52 | | /// </summary> |
| | | 53 | | /// <remarks> |
| | | 54 | | /// TODO check if this properly updated Dependent and has the proper principal relationship. |
| | | 55 | | /// </remarks> |
| | | 56 | | public virtual CollectionItem? Previous { get; set; } |
| | | 57 | | |
| | | 58 | | /// <inheritdoc /> |
| | | 59 | | public void OnSavingChanges() |
| | | 60 | | { |
| | 0 | 61 | | RowVersion++; |
| | 0 | 62 | | } |
| | | 63 | | } |
| | | 64 | | } |