jellyfin/Jellyfin.Data/Entities/Metadata.cs

396 lines
12 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities
{
2020-05-02 21:56:05 +00:00
public abstract partial class Metadata
{
partial void Init();
/// <summary>
/// Default constructor. Protected due to being abstract.
/// </summary>
protected Metadata()
{
PersonRoles = new HashSet<PersonRole>();
Genres = new HashSet<Genre>();
Artwork = new HashSet<Artwork>();
Ratings = new HashSet<Rating>();
Sources = new HashSet<MetadataProviderId>();
Init();
}
/// <summary>
/// Public constructor with required data.
2020-05-02 21:56:05 +00:00
/// </summary>
2020-06-19 10:21:49 +00:00
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
2020-05-02 21:56:05 +00:00
protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified)
{
2020-06-20 08:35:29 +00:00
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException(nameof(title));
}
2020-05-02 21:56:05 +00:00
this.Title = title;
2020-06-20 08:35:29 +00:00
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
}
2020-05-02 21:56:05 +00:00
this.Language = language;
this.PersonRoles = new HashSet<PersonRole>();
this.Genres = new HashSet<Genre>();
this.Artwork = new HashSet<Artwork>();
this.Ratings = new HashSet<Rating>();
this.Sources = new HashSet<MetadataProviderId>();
Init();
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Backing field for Id.
2020-05-02 21:56:05 +00:00
/// </summary>
internal int _Id;
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before setting.
/// </summary>
partial void SetId(int oldValue, ref int newValue);
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before returning.
/// </summary>
partial void GetId(ref int result);
/// <summary>
/// Identity, Indexed, Required.
2020-05-02 21:56:05 +00:00
/// </summary>
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id
{
get
{
int value = _Id;
GetId(ref value);
2020-06-19 09:57:37 +00:00
return _Id = value;
2020-05-02 21:56:05 +00:00
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
protected set
{
int oldValue = _Id;
SetId(oldValue, ref value);
if (oldValue != value)
{
_Id = value;
}
}
}
/// <summary>
/// Backing field for Title.
2020-05-02 21:56:05 +00:00
/// </summary>
protected string _Title;
/// <summary>
/// When provided in a partial class, allows value of Title to be changed before setting.
/// </summary>
partial void SetTitle(string oldValue, ref string newValue);
/// <summary>
/// When provided in a partial class, allows value of Title to be changed before returning.
/// </summary>
partial void GetTitle(ref string result);
/// <summary>
/// Required, Max length = 1024
/// The title or name of the object.
2020-05-02 21:56:05 +00:00
/// </summary>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Title
{
get
{
string value = _Title;
GetTitle(ref value);
2020-06-19 09:57:37 +00:00
return _Title = value;
2020-05-02 21:56:05 +00:00
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
set
{
string oldValue = _Title;
SetTitle(oldValue, ref value);
if (oldValue != value)
{
_Title = value;
}
}
}
/// <summary>
/// Backing field for OriginalTitle.
2020-05-02 21:56:05 +00:00
/// </summary>
protected string _OriginalTitle;
/// <summary>
/// When provided in a partial class, allows value of OriginalTitle to be changed before setting.
/// </summary>
partial void SetOriginalTitle(string oldValue, ref string newValue);
/// <summary>
/// When provided in a partial class, allows value of OriginalTitle to be changed before returning.
/// </summary>
partial void GetOriginalTitle(ref string result);
/// <summary>
/// Max length = 1024
/// </summary>
[MaxLength(1024)]
[StringLength(1024)]
public string OriginalTitle
{
get
{
2020-05-02 21:56:05 +00:00
string value = _OriginalTitle;
GetOriginalTitle(ref value);
2020-06-19 09:57:37 +00:00
return _OriginalTitle = value;
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
set
{
2020-05-02 21:56:05 +00:00
string oldValue = _OriginalTitle;
SetOriginalTitle(oldValue, ref value);
if (oldValue != value)
{
_OriginalTitle = value;
}
}
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Backing field for SortTitle.
2020-05-02 21:56:05 +00:00
/// </summary>
protected string _SortTitle;
/// <summary>
/// When provided in a partial class, allows value of SortTitle to be changed before setting.
/// </summary>
partial void SetSortTitle(string oldValue, ref string newValue);
/// <summary>
/// When provided in a partial class, allows value of SortTitle to be changed before returning.
/// </summary>
partial void GetSortTitle(ref string result);
/// <summary>
/// Max length = 1024
/// </summary>
[MaxLength(1024)]
[StringLength(1024)]
public string SortTitle
{
get
{
2020-05-02 21:56:05 +00:00
string value = _SortTitle;
GetSortTitle(ref value);
2020-06-19 09:57:37 +00:00
return _SortTitle = value;
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
set
{
2020-05-02 21:56:05 +00:00
string oldValue = _SortTitle;
SetSortTitle(oldValue, ref value);
if (oldValue != value)
{
_SortTitle = value;
}
}
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Backing field for Language.
2020-05-02 21:56:05 +00:00
/// </summary>
protected string _Language;
/// <summary>
/// When provided in a partial class, allows value of Language to be changed before setting.
/// </summary>
partial void SetLanguage(string oldValue, ref string newValue);
/// <summary>
/// When provided in a partial class, allows value of Language to be changed before returning.
/// </summary>
partial void GetLanguage(ref string result);
/// <summary>
/// Required, Min length = 3, Max length = 3
/// ISO-639-3 3-character language codes.
2020-05-02 21:56:05 +00:00
/// </summary>
[Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
public string Language
{
get
{
2020-05-02 21:56:05 +00:00
string value = _Language;
GetLanguage(ref value);
2020-06-19 09:57:37 +00:00
return _Language = value;
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
set
{
2020-05-02 21:56:05 +00:00
string oldValue = _Language;
SetLanguage(oldValue, ref value);
if (oldValue != value)
{
_Language = value;
}
}
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Backing field for ReleaseDate.
2020-05-02 21:56:05 +00:00
/// </summary>
protected DateTimeOffset? _ReleaseDate;
/// <summary>
/// When provided in a partial class, allows value of ReleaseDate to be changed before setting.
/// </summary>
partial void SetReleaseDate(DateTimeOffset? oldValue, ref DateTimeOffset? newValue);
/// <summary>
/// When provided in a partial class, allows value of ReleaseDate to be changed before returning.
/// </summary>
partial void GetReleaseDate(ref DateTimeOffset? result);
public DateTimeOffset? ReleaseDate
{
get
{
2020-05-02 21:56:05 +00:00
DateTimeOffset? value = _ReleaseDate;
GetReleaseDate(ref value);
2020-06-19 09:57:37 +00:00
return _ReleaseDate = value;
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
set
{
2020-05-02 21:56:05 +00:00
DateTimeOffset? oldValue = _ReleaseDate;
SetReleaseDate(oldValue, ref value);
if (oldValue != value)
{
_ReleaseDate = value;
}
}
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Backing field for DateAdded.
2020-05-02 21:56:05 +00:00
/// </summary>
protected DateTime _DateAdded;
/// <summary>
/// When provided in a partial class, allows value of DateAdded to be changed before setting.
/// </summary>
partial void SetDateAdded(DateTime oldValue, ref DateTime newValue);
/// <summary>
/// When provided in a partial class, allows value of DateAdded to be changed before returning.
/// </summary>
partial void GetDateAdded(ref DateTime result);
/// <summary>
/// Required.
2020-05-02 21:56:05 +00:00
/// </summary>
[Required]
public DateTime DateAdded
{
get
{
DateTime value = _DateAdded;
GetDateAdded(ref value);
2020-06-19 09:57:37 +00:00
return _DateAdded = value;
2020-05-02 21:56:05 +00:00
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
internal set
{
DateTime oldValue = _DateAdded;
SetDateAdded(oldValue, ref value);
if (oldValue != value)
{
_DateAdded = value;
}
}
}
/// <summary>
/// Backing field for DateModified.
2020-05-02 21:56:05 +00:00
/// </summary>
protected DateTime _DateModified;
/// <summary>
/// When provided in a partial class, allows value of DateModified to be changed before setting.
/// </summary>
partial void SetDateModified(DateTime oldValue, ref DateTime newValue);
/// <summary>
/// When provided in a partial class, allows value of DateModified to be changed before returning.
/// </summary>
partial void GetDateModified(ref DateTime result);
/// <summary>
/// Required.
2020-05-02 21:56:05 +00:00
/// </summary>
[Required]
public DateTime DateModified
{
get
{
DateTime value = _DateModified;
GetDateModified(ref value);
2020-06-19 09:57:37 +00:00
return _DateModified = value;
2020-05-02 21:56:05 +00:00
}
2020-06-15 21:43:52 +00:00
2020-05-02 21:56:05 +00:00
internal set
{
DateTime oldValue = _DateModified;
SetDateModified(oldValue, ref value);
if (oldValue != value)
{
_DateModified = value;
}
}
}
/// <summary>
/// Required, ConcurrenyToken.
2020-05-02 21:56:05 +00:00
/// </summary>
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
2020-05-02 21:56:05 +00:00
public void OnSavingChanges()
{
RowVersion++;
}
2020-05-02 21:56:05 +00:00
/*************************************************************************
* Navigation properties
*************************************************************************/
2020-05-02 21:56:05 +00:00
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<PersonRole> PersonRoles { get; protected set; }
2020-05-02 21:56:05 +00:00
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<Genre> Genres { get; protected set; }
2020-05-02 21:56:05 +00:00
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<Artwork> Artwork { get; protected set; }
2020-05-02 21:56:05 +00:00
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<Rating> Ratings { get; protected set; }
2020-05-02 21:56:05 +00:00
[ForeignKey("PersonRole_PersonRoles_Id")]
public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
}
}