using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing a library item.
///
public abstract class LibraryItem : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The library of this item.
protected LibraryItem(Library library)
{
DateAdded = DateTime.UtcNow;
Library = library;
}
///
/// Initializes a new instance of the class.
///
protected LibraryItem()
{
}
///
/// Gets or sets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
/// Gets or sets the date this library item was added.
///
public DateTime DateAdded { get; protected set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; protected set; }
///
/// Gets or sets the library of this item.
///
///
/// Required.
///
[Required]
public virtual Library Library { get; set; }
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}