aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jellyfin.Data/Entities/ActivityLog.cs3
-rw-r--r--Jellyfin.Data/Entities/Group.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/Artwork.cs203
-rw-r--r--Jellyfin.Data/Entities/Libraries/Book.cs62
-rw-r--r--Jellyfin.Data/Entities/Libraries/BookMetadata.cs120
-rw-r--r--Jellyfin.Data/Entities/Libraries/Chapter.cs257
-rw-r--r--Jellyfin.Data/Entities/Libraries/Collection.cs112
-rw-r--r--Jellyfin.Data/Entities/Libraries/CollectionItem.cs152
-rw-r--r--Jellyfin.Data/Entities/Libraries/Company.cs156
-rw-r--r--Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs226
-rw-r--r--Jellyfin.Data/Entities/Libraries/CustomItem.cs61
-rw-r--r--Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs77
-rw-r--r--Jellyfin.Data/Entities/Libraries/Episode.cs114
-rw-r--r--Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs191
-rw-r--r--Jellyfin.Data/Entities/Libraries/Genre.cs147
-rw-r--r--Jellyfin.Data/Entities/Libraries/Library.cs143
-rw-r--r--Jellyfin.Data/Entities/Libraries/LibraryItem.cs164
-rw-r--r--Jellyfin.Data/Entities/Libraries/LibraryRoot.cs199
-rw-r--r--Jellyfin.Data/Entities/Libraries/MediaFile.cs200
-rw-r--r--Jellyfin.Data/Entities/Libraries/MediaFileStream.cs144
-rw-r--r--Jellyfin.Data/Entities/Libraries/Metadata.cs392
-rw-r--r--Jellyfin.Data/Entities/Libraries/MetadataProvider.cs134
-rw-r--r--Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs194
-rw-r--r--Jellyfin.Data/Entities/Libraries/Movie.cs64
-rw-r--r--Jellyfin.Data/Entities/Libraries/MovieMetadata.cs249
-rw-r--r--Jellyfin.Data/Entities/Libraries/MusicAlbum.cs60
-rw-r--r--Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs204
-rw-r--r--Jellyfin.Data/Entities/Libraries/Person.cs308
-rw-r--r--Jellyfin.Data/Entities/Libraries/PersonRole.cs215
-rw-r--r--Jellyfin.Data/Entities/Libraries/Photo.cs61
-rw-r--r--Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs79
-rw-r--r--Jellyfin.Data/Entities/Libraries/Rating.cs186
-rw-r--r--Jellyfin.Data/Entities/Libraries/RatingSource.cs227
-rw-r--r--Jellyfin.Data/Entities/Libraries/Release.cs211
-rw-r--r--Jellyfin.Data/Entities/Libraries/Season.cs114
-rw-r--r--Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs115
-rw-r--r--Jellyfin.Data/Entities/Libraries/Series.cs153
-rw-r--r--Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs241
-rw-r--r--Jellyfin.Data/Entities/Libraries/Track.cs116
-rw-r--r--Jellyfin.Data/Entities/Libraries/TrackMetadata.cs77
-rw-r--r--Jellyfin.Data/Entities/Permission.cs3
-rw-r--r--Jellyfin.Data/Entities/Preference.cs3
-rw-r--r--Jellyfin.Data/Entities/User.cs3
-rw-r--r--Jellyfin.Data/ISavingChanges.cs9
-rw-r--r--Jellyfin.Data/Interfaces/IHasArtwork.cs16
-rw-r--r--Jellyfin.Data/Interfaces/IHasCompanies.cs16
-rw-r--r--Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs18
-rw-r--r--Jellyfin.Data/Interfaces/IHasPermissions.cs (renamed from Jellyfin.Data/IHasPermissions.cs)0
-rw-r--r--Jellyfin.Data/Interfaces/IHasReleases.cs16
-rw-r--r--Jellyfin.Server.Implementations/JellyfinDb.cs4
50 files changed, 1172 insertions, 5050 deletions
diff --git a/Jellyfin.Data/Entities/ActivityLog.cs b/Jellyfin.Data/Entities/ActivityLog.cs
index ac61b9e3b..3858916d1 100644
--- a/Jellyfin.Data/Entities/ActivityLog.cs
+++ b/Jellyfin.Data/Entities/ActivityLog.cs
@@ -3,6 +3,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Data.Entities
@@ -10,7 +11,7 @@ namespace Jellyfin.Data.Entities
/// <summary>
/// An entity referencing an activity log entry.
/// </summary>
- public partial class ActivityLog : ISavingChanges
+ public partial class ActivityLog : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLog"/> class.
diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs
index a1ec6b1fa..ca12ba421 100644
--- a/Jellyfin.Data/Entities/Group.cs
+++ b/Jellyfin.Data/Entities/Group.cs
@@ -6,13 +6,14 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity representing a group.
/// </summary>
- public partial class Group : IHasPermissions, ISavingChanges
+ public partial class Group : IHasPermissions, IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Group"/> class.
diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.cs
index 2a34a8dff..7be22af25 100644
--- a/Jellyfin.Data/Entities/Libraries/Artwork.cs
+++ b/Jellyfin.Data/Entities/Libraries/Artwork.cs
@@ -1,210 +1,81 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Artwork
+ /// <summary>
+ /// An entity representing artwork.
+ /// </summary>
+ public class Artwork : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Artwork()
- {
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the <see cref="Artwork"/> class.
/// </summary>
- public static Artwork CreateArtworkUnsafe()
- {
- return new Artwork();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="path"></param>
- /// <param name="kind"></param>
- /// <param name="_metadata0"></param>
- /// <param name="_personrole1"></param>
- public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
+ /// <param name="path">The path.</param>
+ /// <param name="kind">The kind of art.</param>
+ /// <param name="owner">The owner.</param>
+ public Artwork(string path, ArtKind kind, IHasArtwork owner)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
- this.Path = path;
-
- this.Kind = kind;
-
- if (_metadata0 == null)
- {
- throw new ArgumentNullException(nameof(_metadata0));
- }
-
- _metadata0.Artwork.Add(this);
+ Path = path;
+ Kind = kind;
- if (_personrole1 == null)
- {
- throw new ArgumentNullException(nameof(_personrole1));
- }
-
- _personrole1.Artwork = this;
-
- Init();
+ owner?.Artwork.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Artwork"/> class.
/// </summary>
- /// <param name="path"></param>
- /// <param name="kind"></param>
- /// <param name="_metadata0"></param>
- /// <param name="_personrole1"></param>
- public static Artwork Create(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Artwork()
{
- return new Artwork(path, kind, _metadata0, _personrole1);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for Id.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Path.
- /// </summary>
- protected string _Path;
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before setting.
- /// </summary>
- partial void SetPath(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before returning.
- /// </summary>
- partial void GetPath(ref string result);
+ /// </remarks>
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
/// <summary>
- /// Required, Max length = 65535
+ /// Gets or sets the path.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 65535.
+ /// </remarks>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
+ public string Path { get; set; }
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Kind.
- /// </summary>
- internal Enums.ArtKind _Kind;
/// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before setting.
+ /// Gets or sets the kind of artwork.
/// </summary>
- partial void SetKind(Enums.ArtKind oldValue, ref Enums.ArtKind newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- /// </summary>
- partial void GetKind(ref Enums.ArtKind result);
-
- /// <summary>
- /// Indexed, Required.
- /// </summary>
- [Required]
- public Enums.ArtKind Kind
- {
- get
- {
- Enums.ArtKind value = _Kind;
- GetKind(ref value);
- return _Kind = value;
- }
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ public ArtKind Kind { get; set; }
- set
- {
- Enums.ArtKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Book.cs b/Jellyfin.Data/Entities/Libraries/Book.cs
index 1ddc5ce8b..8337788dd 100644
--- a/Jellyfin.Data/Entities/Libraries/Book.cs
+++ b/Jellyfin.Data/Entities/Libraries/Book.cs
@@ -1,72 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Book : LibraryItem
+ /// <summary>
+ /// An entity representing a book.
+ /// </summary>
+ public class Book : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Book"/> class.
/// </summary>
- protected Book()
+ public Book()
{
BookMetadata = new HashSet<BookMetadata>();
Releases = new HashSet<Release>();
-
- Init();
}
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets a collection containing the metadata for this book.
/// </summary>
- public static Book CreateBookUnsafe()
- {
- return new Book();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public Book(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.BookMetadata = new HashSet<BookMetadata>();
- this.Releases = new HashSet<Release>();
-
- Init();
- }
-
- /// <summary>
- /// Static create function (for use in LINQ queries, etc.)
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static Book Create(Guid urlid, DateTime dateadded)
- {
- return new Book(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("BookMetadata_BookMetadata_Id")]
public virtual ICollection<BookMetadata> BookMetadata { get; protected set; }
- [ForeignKey("Release_Releases_Id")]
+ /// <inheritdoc />
public virtual ICollection<Release> Releases { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
index 91eecbbf9..bd716712b 100644
--- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
@@ -1,125 +1,55 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class BookMetadata : Metadata
+ /// <summary>
+ /// An entity containing metadata for a book.
+ /// </summary>
+ public class BookMetadata : Metadata, IHasCompanies
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected BookMetadata()
- {
- Publishers = new HashSet<Company>();
-
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static BookMetadata CreateBookMetadataUnsafe()
- {
- return new BookMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="BookMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_book0"></param>
- public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
+ /// <param name="book">The book.</param>
+ public BookMetadata(string title, string language, Book book) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_book0 == null)
+ if (book == null)
{
- throw new ArgumentNullException(nameof(_book0));
+ throw new ArgumentNullException(nameof(book));
}
- _book0.BookMetadata.Add(this);
-
- this.Publishers = new HashSet<Company>();
+ book.BookMetadata.Add(this);
- Init();
+ Publishers = new HashSet<Company>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="BookMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_book0"></param>
- public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected BookMetadata()
{
- return new BookMetadata(title, language, dateadded, datemodified, _book0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for ISBN.
- /// </summary>
- protected long? _ISBN;
/// <summary>
- /// When provided in a partial class, allows value of ISBN to be changed before setting.
+ /// Gets or sets the ISBN.
/// </summary>
- partial void SetISBN(long? oldValue, ref long? newValue);
+ public long? Isbn { get; set; }
+
/// <summary>
- /// When provided in a partial class, allows value of ISBN to be changed before returning.
+ /// Gets or sets a collection of the publishers for this book.
/// </summary>
- partial void GetISBN(ref long? result);
-
- public long? ISBN
- {
- get
- {
- long? value = _ISBN;
- GetISBN(ref value);
- return _ISBN = value;
- }
-
- set
- {
- long? oldValue = _ISBN;
- SetISBN(oldValue, ref value);
- if (oldValue != value)
- {
- _ISBN = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Company_Publishers_Id")]
public virtual ICollection<Company> Publishers { get; protected set; }
+
+ /// <inheritdoc />
+ [NotMapped]
+ public ICollection<Company> Companies => Publishers;
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Chapter.cs b/Jellyfin.Data/Entities/Libraries/Chapter.cs
index 2f3644318..d9293c3cc 100644
--- a/Jellyfin.Data/Entities/Libraries/Chapter.cs
+++ b/Jellyfin.Data/Entities/Libraries/Chapter.cs
@@ -1,277 +1,102 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Chapter
+ /// <summary>
+ /// An entity representing a chapter.
+ /// </summary>
+ public class Chapter : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Chapter()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Chapter CreateChapterUnsafe()
- {
- return new Chapter();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="Chapter"/> class.
/// </summary>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="timestart"></param>
- /// <param name="_release0"></param>
- public Chapter(string language, long timestart, Release _release0)
+ /// <param name="startTime">The start time for this chapter.</param>
+ /// <param name="release">The release.</param>
+ public Chapter(string language, long startTime, Release release)
{
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
}
- this.Language = language;
-
- this.TimeStart = timestart;
+ Language = language;
+ StartTime = startTime;
- if (_release0 == null)
+ if (release == null)
{
- throw new ArgumentNullException(nameof(_release0));
+ throw new ArgumentNullException(nameof(release));
}
- _release0.Chapters.Add(this);
-
-
- Init();
+ release.Chapters.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Chapter"/> class.
/// </summary>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="timestart"></param>
- /// <param name="_release0"></param>
- public static Chapter Create(string language, long timestart, Release _release0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Chapter()
{
- return new Chapter(language, timestart, _release0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ public string Name { get; set; }
/// <summary>
- /// Backing field for Language.
- /// </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.
+ /// Gets or sets the language.
/// </summary>
- partial void GetLanguage(ref string result);
-
- /// <summary>
+ /// <remarks>
/// Required, Min length = 3, Max length = 3
/// ISO-639-3 3-character language codes.
- /// </summary>
+ /// </remarks>
[Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
- public string Language
- {
- get
- {
- string value = _Language;
- GetLanguage(ref value);
- return _Language = value;
- }
+ public string Language { get; set; }
- set
- {
- string oldValue = _Language;
- SetLanguage(oldValue, ref value);
- if (oldValue != value)
- {
- _Language = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for TimeStart.
- /// </summary>
- protected long _TimeStart;
/// <summary>
- /// When provided in a partial class, allows value of TimeStart to be changed before setting.
+ /// Gets or sets the start time.
/// </summary>
- partial void SetTimeStart(long oldValue, ref long newValue);
- /// <summary>
- /// When provided in a partial class, allows value of TimeStart to be changed before returning.
- /// </summary>
- partial void GetTimeStart(ref long result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public long TimeStart
- {
- get
- {
- long value = _TimeStart;
- GetTimeStart(ref value);
- return _TimeStart = value;
- }
-
- set
- {
- long oldValue = _TimeStart;
- SetTimeStart(oldValue, ref value);
- if (oldValue != value)
- {
- _TimeStart = value;
- }
- }
- }
+ /// </remarks>
+ public long StartTime { get; set; }
/// <summary>
- /// Backing field for TimeEnd.
- /// </summary>
- protected long? _TimeEnd;
- /// <summary>
- /// When provided in a partial class, allows value of TimeEnd to be changed before setting.
+ /// Gets or sets the end time.
/// </summary>
- partial void SetTimeEnd(long? oldValue, ref long? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of TimeEnd to be changed before returning.
- /// </summary>
- partial void GetTimeEnd(ref long? result);
-
- public long? TimeEnd
- {
- get
- {
- long? value = _TimeEnd;
- GetTimeEnd(ref value);
- return _TimeEnd = value;
- }
-
- set
- {
- long? oldValue = _TimeEnd;
- SetTimeEnd(oldValue, ref value);
- if (oldValue != value)
- {
- _TimeEnd = value;
- }
- }
- }
+ public long? EndTime { get; set; }
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public uint RowVersion { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Collection.cs b/Jellyfin.Data/Entities/Libraries/Collection.cs
index d054d8ff9..2e1bbcfb6 100644
--- a/Jellyfin.Data/Entities/Libraries/Collection.cs
+++ b/Jellyfin.Data/Entities/Libraries/Collection.cs
@@ -1,123 +1,55 @@
-#pragma warning disable CS1591
-
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Collection
+ /// <summary>
+ /// An entity representing a collection.
+ /// </summary>
+ public class Collection : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor.
+ /// Initializes a new instance of the <see cref="Collection"/> class.
/// </summary>
public Collection()
{
- CollectionItem = new LinkedList<CollectionItem>();
-
- Init();
+ Items = new HashSet<CollectionItem>();
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a collection containing this collection's items.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<CollectionItem> Items { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CollectionItem_CollectionItem_Id")]
- public virtual ICollection<CollectionItem> CollectionItem { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
index 4b01d814f..c9306f630 100644
--- a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
@@ -1,156 +1,94 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CollectionItem
+ /// <summary>
+ /// An entity representing a collection item.
+ /// </summary>
+ public class CollectionItem : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected CollectionItem()
- {
- // NOTE: This class has one-to-one associations with CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static CollectionItem CreateCollectionItemUnsafe()
- {
- return new CollectionItem();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="CollectionItem"/> class.
/// </summary>
- /// <param name="_collection0"></param>
- /// <param name="_collectionitem1"></param>
- /// <param name="_collectionitem2"></param>
- public CollectionItem(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
+ /// <param name="collection">The collection.</param>
+ /// <param name="previous">The previous item.</param>
+ /// <param name="next">The next item.</param>
+ public CollectionItem(Collection collection, CollectionItem previous, CollectionItem next)
{
- // NOTE: This class has one-to-one associations with CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- if (_collection0 == null)
+ if (collection == null)
{
- throw new ArgumentNullException(nameof(_collection0));
+ throw new ArgumentNullException(nameof(collection));
}
- _collection0.CollectionItem.Add(this);
+ collection.Items.Add(this);
- if (_collectionitem1 == null)
+ if (next != null)
{
- throw new ArgumentNullException(nameof(_collectionitem1));
+ Next = next;
+ next.Previous = this;
}
- _collectionitem1.Next = this;
-
- if (_collectionitem2 == null)
+ if (previous != null)
{
- throw new ArgumentNullException(nameof(_collectionitem2));
+ Previous = previous;
+ previous.Next = this;
}
-
- _collectionitem2.Previous = this;
-
- Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="CollectionItem"/> class.
/// </summary>
- /// <param name="_collection0"></param>
- /// <param name="_collectionitem1"></param>
- /// <param name="_collectionitem2"></param>
- public static CollectionItem Create(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected CollectionItem()
{
- return new CollectionItem(_collection0, _collectionitem1, _collectionitem2);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for Id.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; set; }
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
- public void OnSavingChanges()
- {
- RowVersion++;
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
/// <summary>
- /// Required.
+ /// Gets or sets the library item.
/// </summary>
- [ForeignKey("LibraryItem_Id")]
+ /// <remarks>
+ /// Required.
+ /// </remarks>
public virtual LibraryItem LibraryItem { get; set; }
+ /// <summary>
+ /// Gets or sets the next item in the collection.
+ /// </summary>
/// <remarks>
/// TODO check if this properly updated dependant and has the proper principal relationship
/// </remarks>
- [ForeignKey("CollectionItem_Next_Id")]
public virtual CollectionItem Next { get; set; }
+ /// <summary>
+ /// Gets or sets the previous item in the collection.
+ /// </summary>
/// <remarks>
/// TODO check if this properly updated dependant and has the proper principal relationship
/// </remarks>
- [ForeignKey("CollectionItem_Previous_Id")]
public virtual CollectionItem Previous { get; set; }
+
+ /// <inheritdoc />
+ public void OnSavingChanges()
+ {
+ RowVersion++;
+ }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Company.cs b/Jellyfin.Data/Entities/Libraries/Company.cs
index 10df429cd..02da26bc2 100644
--- a/Jellyfin.Data/Entities/Libraries/Company.cs
+++ b/Jellyfin.Data/Entities/Libraries/Company.cs
@@ -1,159 +1,67 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Company
+ /// <summary>
+ /// An entity representing a company.
+ /// </summary>
+ public class Company : IHasCompanies, IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Company"/> class.
/// </summary>
- protected Company()
+ /// <param name="owner">The owner of this company.</param>
+ public Company(IHasCompanies owner)
{
- CompanyMetadata = new HashSet<CompanyMetadata>();
-
- Init();
- }
+ owner?.Companies.Add(this);
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Company CreateCompanyUnsafe()
- {
- return new Company();
+ CompanyMetadata = new HashSet<CompanyMetadata>();
}
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="Company"/> class.
/// </summary>
- /// <param name="_moviemetadata0"></param>
- /// <param name="_seriesmetadata1"></param>
- /// <param name="_musicalbummetadata2"></param>
- /// <param name="_bookmetadata3"></param>
- /// <param name="_company4"></param>
- public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Company()
{
- if (_moviemetadata0 == null)
- {
- throw new ArgumentNullException(nameof(_moviemetadata0));
- }
-
- _moviemetadata0.Studios.Add(this);
-
- if (_seriesmetadata1 == null)
- {
- throw new ArgumentNullException(nameof(_seriesmetadata1));
- }
-
- _seriesmetadata1.Networks.Add(this);
-
- if (_musicalbummetadata2 == null)
- {
- throw new ArgumentNullException(nameof(_musicalbummetadata2));
- }
-
- _musicalbummetadata2.Labels.Add(this);
-
- if (_bookmetadata3 == null)
- {
- throw new ArgumentNullException(nameof(_bookmetadata3));
- }
-
- _bookmetadata3.Publishers.Add(this);
-
- if (_company4 == null)
- {
- throw new ArgumentNullException(nameof(_company4));
- }
-
- _company4.Parent = this;
-
- this.CompanyMetadata = new HashSet<CompanyMetadata>();
-
- Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets the id.
/// </summary>
- /// <param name="_moviemetadata0"></param>
- /// <param name="_seriesmetadata1"></param>
- /// <param name="_musicalbummetadata2"></param>
- /// <param name="_bookmetadata3"></param>
- /// <param name="_company4"></param>
- public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
- {
- return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
- }
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
- /*************************************************************************
- * Properties
- *************************************************************************/
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Backing field for Id.
+ /// Gets or sets a collection containing the metadata.
/// </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);
+ public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
/// <summary>
- /// Identity, Indexed, Required.
+ /// Gets or sets a collection containing this company's child companies.
/// </summary>
- [Key]
- [Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
+ public virtual ICollection<Company> ChildCompanies { get; protected set; }
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ /// <inheritdoc />
+ [NotMapped]
+ public ICollection<Company> Companies => ChildCompanies;
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
- public virtual ICollection<CompanyMetadata> CompanyMetadata { get; protected set; }
- [ForeignKey("Company_Parent_Id")]
- public virtual Company Parent { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
index f81beb0d5..60cc96a34 100644
--- a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
@@ -1,236 +1,74 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CompanyMetadata : Metadata
+ /// <summary>
+ /// An entity holding metadata for a <see cref="Company"/>.
+ /// </summary>
+ public class CompanyMetadata : Metadata
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected CompanyMetadata()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static CompanyMetadata CreateCompanyMetadataUnsafe()
- {
- return new CompanyMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="CompanyMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_company0"></param>
- public CompanyMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
+ /// <param name="company">The company.</param>
+ public CompanyMetadata(string title, string language, Company company) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_company0 == null)
+ if (company == null)
{
- throw new ArgumentNullException(nameof(_company0));
+ throw new ArgumentNullException(nameof(company));
}
- _company0.CompanyMetadata.Add(this);
-
- Init();
+ company.CompanyMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="CompanyMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_company0"></param>
- public static CompanyMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
+ protected CompanyMetadata()
{
- return new CompanyMetadata(title, language, dateadded, datemodified, _company0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for Description.
- /// </summary>
- protected string _Description;
- /// <summary>
- /// When provided in a partial class, allows value of Description to be changed before setting.
- /// </summary>
- partial void SetDescription(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Description to be changed before returning.
- /// </summary>
- partial void GetDescription(ref string result);
-
- /// <summary>
- /// Max length = 65535
+ /// Gets or sets the description.
/// </summary>
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Description
- {
- get
- {
- string value = _Description;
- GetDescription(ref value);
- return _Description = value;
- }
-
- set
- {
- string oldValue = _Description;
- SetDescription(oldValue, ref value);
- if (oldValue != value)
- {
- _Description = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Headquarters.
- /// </summary>
- protected string _Headquarters;
- /// <summary>
- /// When provided in a partial class, allows value of Headquarters to be changed before setting.
- /// </summary>
- partial void SetHeadquarters(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Headquarters to be changed before returning.
- /// </summary>
- partial void GetHeadquarters(ref string result);
+ public string Description { get; set; }
/// <summary>
- /// Max length = 255
+ /// Gets or sets the headquarters.
/// </summary>
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string Headquarters
- {
- get
- {
- string value = _Headquarters;
- GetHeadquarters(ref value);
- return _Headquarters = value;
- }
+ public string Headquarters { get; set; }
- set
- {
- string oldValue = _Headquarters;
- SetHeadquarters(oldValue, ref value);
- if (oldValue != value)
- {
- _Headquarters = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Country.
- /// </summary>
- protected string _Country;
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before setting.
- /// </summary>
- partial void SetCountry(string oldValue, ref string newValue);
/// <summary>
- /// When provided in a partial class, allows value of Country to be changed before returning.
- /// </summary>
- partial void GetCountry(ref string result);
-
- /// <summary>
- /// Max length = 2
+ /// Gets or sets the country code.
/// </summary>
+ /// <remarks>
+ /// Max length = 2.
+ /// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
-
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
+ public string Country { get; set; }
/// <summary>
- /// Backing field for Homepage.
- /// </summary>
- protected string _Homepage;
- /// <summary>
- /// When provided in a partial class, allows value of Homepage to be changed before setting.
- /// </summary>
- partial void SetHomepage(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Homepage to be changed before returning.
- /// </summary>
- partial void GetHomepage(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the homepage.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Homepage
- {
- get
- {
- string value = _Homepage;
- GetHomepage(ref value);
- return _Homepage = value;
- }
-
- set
- {
- string oldValue = _Homepage;
- SetHomepage(oldValue, ref value);
- if (oldValue != value)
- {
- _Homepage = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Homepage { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CustomItem.cs b/Jellyfin.Data/Entities/Libraries/CustomItem.cs
index ffe06db24..6a4f0a537 100644
--- a/Jellyfin.Data/Entities/Libraries/CustomItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/CustomItem.cs
@@ -1,71 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CustomItem : LibraryItem
+ /// <summary>
+ /// An entity representing a custom item.
+ /// </summary>
+ public class CustomItem : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="CustomItem"/> class.
/// </summary>
- protected CustomItem()
+ public CustomItem()
{
CustomItemMetadata = new HashSet<CustomItemMetadata>();
Releases = new HashSet<Release>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static CustomItem CreateCustomItemUnsafe()
- {
- return new CustomItem();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public CustomItem(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.CustomItemMetadata = new HashSet<CustomItemMetadata>();
- this.Releases = new HashSet<Release>();
-
- Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets a collection containing the metadata for this item.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static CustomItem Create(Guid urlid, DateTime dateadded)
- {
- return new CustomItem(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CustomItemMetadata_CustomItemMetadata_Id")]
public virtual ICollection<CustomItemMetadata> CustomItemMetadata { get; protected set; }
- [ForeignKey("Release_Releases_Id")]
+ /// <inheritdoc />
public virtual ICollection<Release> Releases { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
index 8606302d7..bc1835528 100644
--- a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
@@ -1,83 +1,36 @@
-#pragma warning disable CS1591
-
using System;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CustomItemMetadata : Metadata
+ /// <summary>
+ /// An entity containing metadata for a custom item.
+ /// </summary>
+ public class CustomItemMetadata : Metadata
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected CustomItemMetadata()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static CustomItemMetadata CreateCustomItemMetadataUnsafe()
- {
- return new CustomItemMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_customitem0"></param>
- public CustomItemMetadata(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
+ /// <param name="item">The item.</param>
+ public CustomItemMetadata(string title, string language, CustomItem item) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_customitem0 == null)
+ if (item == null)
{
- throw new ArgumentNullException(nameof(_customitem0));
+ throw new ArgumentNullException(nameof(item));
}
- _customitem0.CustomItemMetadata.Add(this);
-
- Init();
+ item.CustomItemMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_customitem0"></param>
- public static CustomItemMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected CustomItemMetadata()
{
- return new CustomItemMetadata(title, language, dateadded, datemodified, _customitem0);
}
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Episode.cs b/Jellyfin.Data/Entities/Libraries/Episode.cs
index 3315b3e30..430a11e3c 100644
--- a/Jellyfin.Data/Entities/Libraries/Episode.cs
+++ b/Jellyfin.Data/Entities/Libraries/Episode.cs
@@ -1,118 +1,52 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Episode : LibraryItem
+ /// <summary>
+ /// An entity representing an episode.
+ /// </summary>
+ public class Episode : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Episode"/> class.
/// </summary>
- protected Episode()
+ /// <param name="season">The season.</param>
+ public Episode(Season season)
{
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
+ if (season == null)
+ {
+ throw new ArgumentNullException(nameof(season));
+ }
+
+ season.Episodes.Add(this);
Releases = new HashSet<Release>();
EpisodeMetadata = new HashSet<EpisodeMetadata>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Episode CreateEpisodeUnsafe()
- {
- return new Episode();
}
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="Episode"/> class.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_season0"></param>
- public Episode(Guid urlid, DateTime dateadded, Season _season0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Episode()
{
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- this.UrlId = urlid;
-
- if (_season0 == null)
- {
- throw new ArgumentNullException(nameof(_season0));
- }
-
- _season0.Episodes.Add(this);
-
- this.Releases = new HashSet<Release>();
- this.EpisodeMetadata = new HashSet<EpisodeMetadata>();
-
- Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets the episode number.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_season0"></param>
- public static Episode Create(Guid urlid, DateTime dateadded, Season _season0)
- {
- return new Episode(urlid, dateadded, _season0);
- }
+ public int? EpisodeNumber { get; set; }
- /*************************************************************************
- * Properties
- *************************************************************************/
+ /// <inheritdoc />
+ public virtual ICollection<Release> Releases { get; protected set; }
/// <summary>
- /// Backing field for EpisodeNumber.
+ /// Gets or sets a collection containing the metadata for this episode.
/// </summary>
- protected int? _EpisodeNumber;
- /// <summary>
- /// When provided in a partial class, allows value of EpisodeNumber to be changed before setting.
- /// </summary>
- partial void SetEpisodeNumber(int? oldValue, ref int? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of EpisodeNumber to be changed before returning.
- /// </summary>
- partial void GetEpisodeNumber(ref int? result);
-
- public int? EpisodeNumber
- {
- get
- {
- int? value = _EpisodeNumber;
- GetEpisodeNumber(ref value);
- return _EpisodeNumber = value;
- }
-
- set
- {
- int? oldValue = _EpisodeNumber;
- SetEpisodeNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _EpisodeNumber = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("Release_Releases_Id")]
- public virtual ICollection<Release> Releases { get; protected set; }
- [ForeignKey("EpisodeMetadata_EpisodeMetadata_Id")]
public virtual ICollection<EpisodeMetadata> EpisodeMetadata { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
index f20ed3573..348100cb4 100644
--- a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
@@ -1,198 +1,67 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class EpisodeMetadata : Metadata
+ /// <summary>
+ /// An entity containing metadata for an <see cref="Episode"/>.
+ /// </summary>
+ public class EpisodeMetadata : Metadata
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected EpisodeMetadata()
- {
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static EpisodeMetadata CreateEpisodeMetadataUnsafe()
- {
- return new EpisodeMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_episode0"></param>
- public EpisodeMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
+ /// <param name="episode">The episode.</param>
+ public EpisodeMetadata(string title, string language, Episode episode) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
+ if (episode == null)
{
- throw new ArgumentNullException(nameof(language));
+ throw new ArgumentNullException(nameof(episode));
}
- this.Language = language;
-
- if (_episode0 == null)
- {
- throw new ArgumentNullException(nameof(_episode0));
- }
-
- _episode0.EpisodeMetadata.Add(this);
-
- Init();
+ episode.EpisodeMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_episode0"></param>
- public static EpisodeMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected EpisodeMetadata()
{
- return new EpisodeMetadata(title, language, dateadded, datemodified, _episode0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Outline.
- /// </summary>
- protected string _Outline;
- /// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- /// </summary>
- partial void SetOutline(string oldValue, ref string newValue);
/// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- /// </summary>
- partial void GetOutline(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the outline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Plot.
- /// </summary>
- protected string _Plot;
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before setting.
- /// </summary>
- partial void SetPlot(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before returning.
- /// </summary>
- partial void GetPlot(ref string result);
+ public string Outline { get; set; }
/// <summary>
- /// Max length = 65535
+ /// Gets or sets the plot.
/// </summary>
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot
- {
- get
- {
- string value = _Plot;
- GetPlot(ref value);
- return _Plot = value;
- }
-
- set
- {
- string oldValue = _Plot;
- SetPlot(oldValue, ref value);
- if (oldValue != value)
- {
- _Plot = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Tagline.
- /// </summary>
- protected string _Tagline;
- /// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before setting.
- /// </summary>
- partial void SetTagline(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before returning.
- /// </summary>
- partial void GetTagline(ref string result);
+ public string Plot { get; set; }
/// <summary>
- /// Max length = 1024
+ /// Gets or sets the tagline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline
- {
- get
- {
- string value = _Tagline;
- GetTagline(ref value);
- return _Tagline = value;
- }
-
- set
- {
- string oldValue = _Tagline;
- SetTagline(oldValue, ref value);
- if (oldValue != value)
- {
- _Tagline = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Tagline { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Genre.cs b/Jellyfin.Data/Entities/Libraries/Genre.cs
index c0b391ac8..aeedd7bfd 100644
--- a/Jellyfin.Data/Entities/Libraries/Genre.cs
+++ b/Jellyfin.Data/Entities/Libraries/Genre.cs
@@ -1,162 +1,75 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Genre
+ /// <summary>
+ /// An entity representing a genre.
+ /// </summary>
+ public class Genre : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Genre()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Genre CreateGenreUnsafe()
- {
- return new Genre();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="Genre"/> class.
/// </summary>
- /// <param name="name"></param>
- /// <param name="_metadata0"></param>
- public Genre(string name, Metadata _metadata0)
+ /// <param name="name">The name.</param>
+ /// <param name="metadata">The metadata.</param>
+ public Genre(string name, Metadata metadata)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
+ Name = name;
- if (_metadata0 == null)
+ if (metadata == null)
{
- throw new ArgumentNullException(nameof(_metadata0));
+ throw new ArgumentNullException(nameof(metadata));
}
- _metadata0.Genres.Add(this);
-
- Init();
+ metadata.Genres.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Genre"/> class.
/// </summary>
- /// <param name="name"></param>
- /// <param name="_metadata0"></param>
- public static Genre Create(string name, Metadata _metadata0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Genre()
{
- return new Genre(name, _metadata0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- internal string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Indexed, Required, Max length = 255
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Indexed, Required, Max length = 255.
+ /// </remarks>
[Required]
[MaxLength(255)]
[StringLength(255)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public uint RowVersion { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Library.cs b/Jellyfin.Data/Entities/Libraries/Library.cs
index 9a97a3b00..4f82a2e2a 100644
--- a/Jellyfin.Data/Entities/Libraries/Library.cs
+++ b/Jellyfin.Data/Entities/Libraries/Library.cs
@@ -1,153 +1,76 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Library
+ /// <summary>
+ /// An entity representing a library.
+ /// </summary>
+ public class Library : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Library"/> class.
/// </summary>
- protected Library()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Library CreateLibraryUnsafe()
- {
- return new Library();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="name"></param>
+ /// <param name="name">The name of the library.</param>
public Library(string name)
{
- if (string.IsNullOrEmpty(name))
+ if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
-
- Init();
+ Name = name;
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Library"/> class.
/// </summary>
- /// <param name="name"></param>
- public static Library Create(string name)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Library()
{
- return new Library(name);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
+ public int Id { get; protected set; }
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
/// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
+ /// Gets or sets the name.
/// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ /// <remarks>
+ /// Required, Max length = 128.
+ /// </remarks>
+ [Required]
+ [MaxLength(128)]
+ [StringLength(128)]
+ public string Name { get; set; }
/// <summary>
- /// Required, Max length = 1024
+ /// Gets or sets the root path of the library.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
- [MaxLength(1024)]
- [StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ public string Path { get; set; }
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
index b5f032365..a9167aa7f 100644
--- a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
@@ -1,175 +1,63 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public abstract partial class LibraryItem
+ /// <summary>
+ /// An entity representing a library item.
+ /// </summary>
+ public abstract class LibraryItem : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to being abstract.
+ /// Initializes a new instance of the <see cref="LibraryItem"/> class.
/// </summary>
- protected LibraryItem()
+ /// <param name="library">The library of this item.</param>
+ protected LibraryItem(Library library)
{
- Init();
+ DateAdded = DateTime.UtcNow;
+ Library = library;
}
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="LibraryItem"/> class.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- protected LibraryItem(Guid urlid, DateTime dateadded)
+ protected LibraryItem()
{
- this.UrlId = urlid;
-
-
- Init();
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for Id.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for UrlId.
- /// </summary>
- internal Guid _UrlId;
- /// <summary>
- /// When provided in a partial class, allows value of UrlId to be changed before setting.
- /// </summary>
- partial void SetUrlId(Guid oldValue, ref Guid newValue);
- /// <summary>
- /// When provided in a partial class, allows value of UrlId to be changed before returning.
- /// </summary>
- partial void GetUrlId(ref Guid result);
+ public int Id { get; protected set; }
/// <summary>
- /// Indexed, Required
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
+ /// Gets or sets the date this library item was added.
/// </summary>
- [Required]
- public Guid UrlId
- {
- get
- {
- Guid value = _UrlId;
- GetUrlId(ref value);
- return _UrlId = value;
- }
+ public DateTime DateAdded { get; protected set; }
- set
- {
- Guid oldValue = _UrlId;
- SetUrlId(oldValue, ref value);
- if (oldValue != value)
- {
- _UrlId = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; protected set; }
/// <summary>
- /// Backing field for DateAdded.
+ /// Gets or sets the library of this item.
/// </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>
+ /// <remarks>
/// Required.
- /// </summary>
+ /// </remarks>
[Required]
- public DateTime DateAdded
- {
- get
- {
- DateTime value = _DateAdded;
- GetDateAdded(ref value);
- return _DateAdded = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateAdded;
- SetDateAdded(oldValue, ref value);
- if (oldValue != value)
- {
- _DateAdded = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual Library Library { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- /// <summary>
- /// Required.
- /// </summary>
- [ForeignKey("LibraryRoot_Id")]
- public virtual LibraryRoot LibraryRoot { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs b/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs
deleted file mode 100644
index bbd904447..000000000
--- a/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-#pragma warning disable CS1591
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Jellyfin.Data.Entities.Libraries
-{
- public partial class LibraryRoot
- {
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected LibraryRoot()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static LibraryRoot CreateLibraryRootUnsafe()
- {
- return new LibraryRoot();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="path">Absolute Path.</param>
- public LibraryRoot(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException(nameof(path));
- }
-
- this.Path = path;
-
- Init();
- }
-
- /// <summary>
- /// Static create function (for use in LINQ queries, etc.)
- /// </summary>
- /// <param name="path">Absolute Path.</param>
- public static LibraryRoot Create(string path)
- {
- return new LibraryRoot(path);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
- /// </summary>
- [Key]
- [Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Path.
- /// </summary>
- protected string _Path;
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before setting.
- /// </summary>
- partial void SetPath(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before returning.
- /// </summary>
- partial void GetPath(ref string result);
-
- /// <summary>
- /// Required, Max length = 65535
- /// Absolute Path.
- /// </summary>
- [Required]
- [MaxLength(65535)]
- [StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
-
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for NetworkPath.
- /// </summary>
- protected string _NetworkPath;
- /// <summary>
- /// When provided in a partial class, allows value of NetworkPath to be changed before setting.
- /// </summary>
- partial void SetNetworkPath(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of NetworkPath to be changed before returning.
- /// </summary>
- partial void GetNetworkPath(ref string result);
-
- /// <summary>
- /// Max length = 65535
- /// Absolute network path, for example for transcoding sattelites.
- /// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string NetworkPath
- {
- get
- {
- string value = _NetworkPath;
- GetNetworkPath(ref value);
- return _NetworkPath = value;
- }
-
- set
- {
- string oldValue = _NetworkPath;
- SetNetworkPath(oldValue, ref value);
- if (oldValue != value)
- {
- _NetworkPath = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
-
- public void OnSavingChanges()
- {
- RowVersion++;
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- /// <summary>
- /// Required.
- /// </summary>
- [ForeignKey("Library_Id")]
- public virtual Library Library { get; set; }
- }
-}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.cs
index c9efdb143..8bc649c98 100644
--- a/Jellyfin.Data/Entities/Libraries/MediaFile.cs
+++ b/Jellyfin.Data/Entities/Libraries/MediaFile.cs
@@ -1,212 +1,94 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MediaFile
+ /// <summary>
+ /// An entity representing a file on disk.
+ /// </summary>
+ public class MediaFile : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="MediaFile"/> class.
/// </summary>
- protected MediaFile()
- {
- MediaFileStreams = new HashSet<MediaFileStream>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MediaFile CreateMediaFileUnsafe()
- {
- return new MediaFile();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="path">Relative to the LibraryRoot.</param>
- /// <param name="kind"></param>
- /// <param name="_release0"></param>
- public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
+ /// <param name="path">The path relative to the LibraryRoot.</param>
+ /// <param name="kind">The file kind.</param>
+ /// <param name="release">The release.</param>
+ public MediaFile(string path, MediaFileKind kind, Release release)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
- this.Path = path;
-
- this.Kind = kind;
+ Path = path;
+ Kind = kind;
- if (_release0 == null)
+ if (release == null)
{
- throw new ArgumentNullException(nameof(_release0));
+ throw new ArgumentNullException(nameof(release));
}
- _release0.MediaFiles.Add(this);
+ release.MediaFiles.Add(this);
- this.MediaFileStreams = new HashSet<MediaFileStream>();
-
- Init();
+ MediaFileStreams = new HashSet<MediaFileStream>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MediaFile"/> class.
/// </summary>
- /// <param name="path">Relative to the LibraryRoot.</param>
- /// <param name="kind"></param>
- /// <param name="_release0"></param>
- public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MediaFile()
{
- return new MediaFile(path, kind, _release0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for Path.
- /// </summary>
- protected string _Path;
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before setting.
- /// </summary>
- partial void SetPath(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Path to be changed before returning.
- /// </summary>
- partial void GetPath(ref string result);
-
- /// <summary>
- /// Required, Max length = 65535
- /// Relative to the LibraryRoot.
+ /// Gets or sets the path relative to the library root.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 65535.
+ /// </remarks>
[Required]
[MaxLength(65535)]
[StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
+ public string Path { get; set; }
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Kind.
- /// </summary>
- protected Enums.MediaFileKind _Kind;
/// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before setting.
+ /// Gets or sets the kind of media file.
/// </summary>
- partial void SetKind(Enums.MediaFileKind oldValue, ref Enums.MediaFileKind newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- /// </summary>
- partial void GetKind(ref Enums.MediaFileKind result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public Enums.MediaFileKind Kind
- {
- get
- {
- Enums.MediaFileKind value = _Kind;
- GetKind(ref value);
- return _Kind = value;
- }
+ /// </remarks>
+ public MediaFileKind Kind { get; set; }
- set
- {
- Enums.MediaFileKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a collection containing the streams in this file.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<MediaFileStream> MediaFileStreams { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("MediaFileStream_MediaFileStreams_Id")]
- public virtual ICollection<MediaFileStream> MediaFileStreams { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
index f1f26ecbb..5b03e260e 100644
--- a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
+++ b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
@@ -1,155 +1,67 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MediaFileStream
+ /// <summary>
+ /// An entity representing a stream in a media file.
+ /// </summary>
+ public class MediaFileStream : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="MediaFileStream"/> class.
/// </summary>
- protected MediaFileStream()
+ /// <param name="streamNumber">The number of this stream.</param>
+ /// <param name="mediaFile">The media file.</param>
+ public MediaFileStream(int streamNumber, MediaFile mediaFile)
{
- Init();
- }
+ StreamNumber = streamNumber;
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MediaFileStream CreateMediaFileStreamUnsafe()
- {
- return new MediaFileStream();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="streamnumber"></param>
- /// <param name="_mediafile0"></param>
- public MediaFileStream(int streamnumber, MediaFile _mediafile0)
- {
- this.StreamNumber = streamnumber;
-
- if (_mediafile0 == null)
+ if (mediaFile == null)
{
- throw new ArgumentNullException(nameof(_mediafile0));
+ throw new ArgumentNullException(nameof(mediaFile));
}
- _mediafile0.MediaFileStreams.Add(this);
-
- Init();
+ mediaFile.MediaFileStreams.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MediaFileStream"/> class.
/// </summary>
- /// <param name="streamnumber"></param>
- /// <param name="_mediafile0"></param>
- public static MediaFileStream Create(int streamnumber, MediaFile _mediafile0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MediaFileStream()
{
- return new MediaFileStream(streamnumber, _mediafile0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for StreamNumber.
+ /// Gets or sets the stream number.
/// </summary>
- protected int _StreamNumber;
- /// <summary>
- /// When provided in a partial class, allows value of StreamNumber to be changed before setting.
- /// </summary>
- partial void SetStreamNumber(int oldValue, ref int newValue);
- /// <summary>
- /// When provided in a partial class, allows value of StreamNumber to be changed before returning.
- /// </summary>
- partial void GetStreamNumber(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public int StreamNumber
- {
- get
- {
- int value = _StreamNumber;
- GetStreamNumber(ref value);
- return _StreamNumber = value;
- }
-
- set
- {
- int oldValue = _StreamNumber;
- SetStreamNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _StreamNumber = value;
- }
- }
- }
+ /// </remarks>
+ public int StreamNumber { get; set; }
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Metadata.cs b/Jellyfin.Data/Entities/Libraries/Metadata.cs
index 449e807de..877bb5fbd 100644
--- a/Jellyfin.Data/Entities/Libraries/Metadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/Metadata.cs
@@ -1,399 +1,165 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public abstract partial class Metadata
+ /// <summary>
+ /// An abstract class that holds metadata.
+ /// </summary>
+ public abstract class Metadata : IHasArtwork, IHasConcurrencyToken
{
- 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.
+ /// Initializes a new instance of the <see cref="Metadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified)
+ protected Metadata(string title, string language)
{
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException(nameof(title));
}
- this.Title = title;
-
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
}
- 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>();
+ Title = title;
+ Language = language;
+ DateAdded = DateTime.UtcNow;
+ DateModified = DateAdded;
- Init();
+ PersonRoles = new HashSet<PersonRole>();
+ Genres = new HashSet<Genre>();
+ Artwork = new HashSet<Artwork>();
+ Ratings = new HashSet<Rating>();
+ Sources = new HashSet<MetadataProviderId>();
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Initializes a new instance of the <see cref="Metadata"/> class.
/// </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.
- /// </summary>
- [Key]
- [Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
+ /// <remarks>
+ /// Default constructor. Protected due to being abstract.
+ /// </remarks>
+ protected Metadata()
{
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
}
/// <summary>
- /// Backing field for Title.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetTitle(ref string result);
+ /// <remarks>
+ /// Identity, Indexed, Required.
+ /// </remarks>
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
/// <summary>
- /// Required, Max length = 1024
- /// The title or name of the object.
+ /// Gets or sets the title.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 1024.
+ /// </remarks>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Title
- {
- get
- {
- string value = _Title;
- GetTitle(ref value);
- return _Title = value;
- }
+ public string Title { get; set; }
- set
- {
- string oldValue = _Title;
- SetTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _Title = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for OriginalTitle.
- /// </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
+ /// Gets or sets the original title.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string OriginalTitle
- {
- get
- {
- string value = _OriginalTitle;
- GetOriginalTitle(ref value);
- return _OriginalTitle = value;
- }
-
- set
- {
- string oldValue = _OriginalTitle;
- SetOriginalTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _OriginalTitle = value;
- }
- }
- }
+ public string OriginalTitle { get; set; }
/// <summary>
- /// Backing field for SortTitle.
- /// </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
+ /// Gets or sets the sort title.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string SortTitle
- {
- get
- {
- string value = _SortTitle;
- GetSortTitle(ref value);
- return _SortTitle = value;
- }
-
- set
- {
- string oldValue = _SortTitle;
- SetSortTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _SortTitle = value;
- }
- }
- }
+ public string SortTitle { get; set; }
/// <summary>
- /// Backing field for Language.
- /// </summary>
- protected string _Language;
- /// <summary>
- /// When provided in a partial class, allows value of Language to be changed before setting.
+ /// Gets or sets the language.
/// </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
+ /// <remarks>
+ /// Required, Min length = 3, Max length = 3.
/// ISO-639-3 3-character language codes.
- /// </summary>
+ /// </remarks>
[Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
- public string Language
- {
- get
- {
- string value = _Language;
- GetLanguage(ref value);
- return _Language = value;
- }
-
- set
- {
- string oldValue = _Language;
- SetLanguage(oldValue, ref value);
- if (oldValue != value)
- {
- _Language = value;
- }
- }
- }
+ public string Language { get; set; }
/// <summary>
- /// Backing field for ReleaseDate.
+ /// Gets or sets the release date.
/// </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
- {
- DateTimeOffset? value = _ReleaseDate;
- GetReleaseDate(ref value);
- return _ReleaseDate = value;
- }
-
- set
- {
- DateTimeOffset? oldValue = _ReleaseDate;
- SetReleaseDate(oldValue, ref value);
- if (oldValue != value)
- {
- _ReleaseDate = value;
- }
- }
- }
+ public DateTimeOffset? ReleaseDate { get; set; }
/// <summary>
- /// Backing field for DateAdded.
+ /// Gets or sets the date added.
/// </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);
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ public DateTime DateAdded { get; protected set; }
/// <summary>
- /// Required.
+ /// Gets or sets the date modified.
/// </summary>
- [Required]
- public DateTime DateAdded
- {
- get
- {
- DateTime value = _DateAdded;
- GetDateAdded(ref value);
- return _DateAdded = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateAdded;
- SetDateAdded(oldValue, ref value);
- if (oldValue != value)
- {
- _DateAdded = value;
- }
- }
- }
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ public DateTime DateModified { get; set; }
/// <summary>
- /// Backing field for DateModified.
+ /// Gets or sets the row version.
/// </summary>
- protected DateTime _DateModified;
+ /// <remarks>
+ /// Required, ConcurrencyToken.
+ /// </remarks>
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
+
/// <summary>
- /// When provided in a partial class, allows value of DateModified to be changed before setting.
+ /// Gets or sets a collection containing the person roles for this item.
/// </summary>
- partial void SetDateModified(DateTime oldValue, ref DateTime newValue);
+ public virtual ICollection<PersonRole> PersonRoles { get; protected set; }
+
/// <summary>
- /// When provided in a partial class, allows value of DateModified to be changed before returning.
+ /// Gets or sets a collection containing the generes for this item.
/// </summary>
- partial void GetDateModified(ref DateTime result);
+ public virtual ICollection<Genre> Genres { get; protected set; }
+
+ /// <inheritdoc />
+ public virtual ICollection<Artwork> Artwork { get; protected set; }
/// <summary>
- /// Required.
+ /// Gets or sets a collection containing the ratings for this item.
/// </summary>
- [Required]
- public DateTime DateModified
- {
- get
- {
- DateTime value = _DateModified;
- GetDateModified(ref value);
- return _DateModified = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateModified;
- SetDateModified(oldValue, ref value);
- if (oldValue != value)
- {
- _DateModified = value;
- }
- }
- }
+ public virtual ICollection<Rating> Ratings { get; protected set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a collection containing the metadata sources for this item.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection<PersonRole> PersonRoles { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection<Genre> Genres { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection<Artwork> Artwork { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection<Rating> Ratings { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
index d5462113b..a18a612bc 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
@@ -1,35 +1,19 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MetadataProvider
+ /// <summary>
+ /// An entity representing a metadata provider.
+ /// </summary>
+ public class MetadataProvider : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected MetadataProvider()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MetadataProvider CreateMetadataProviderUnsafe()
- {
- return new MetadataProvider();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="MetadataProvider"/> class.
/// </summary>
- /// <param name="name"></param>
+ /// <param name="name">The name of the metadata provider.</param>
public MetadataProvider(string name)
{
if (string.IsNullOrEmpty(name))
@@ -37,117 +21,47 @@ namespace Jellyfin.Data.Entities.Libraries
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
-
- Init();
+ Name = name;
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MetadataProvider"/> class.
/// </summary>
- /// <param name="name"></param>
- public static MetadataProvider Create(string name)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MetadataProvider()
{
- return new MetadataProvider(name);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Required, Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 1024.
+ /// </remarks>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
-
- /// <summary>
- /// Required, ConcurrenyToken.
- /// </summary>
+ /// <inheritdoc />
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
index fed9d4f0b..6e6de598e 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
@@ -1,201 +1,83 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MetadataProviderId
+ /// <summary>
+ /// An entity representing a unique identifier for a metadata provider.
+ /// </summary>
+ public class MetadataProviderId : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected MetadataProviderId()
- {
- // NOTE: This class has one-to-one associations with MetadataProviderId.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
/// </summary>
- public static MetadataProviderId CreateMetadataProviderIdUnsafe()
+ /// <param name="providerId">The provider id.</param>
+ /// <param name="metadata">The metadata entity.</param>
+ public MetadataProviderId(string providerId, Metadata metadata)
{
- return new MetadataProviderId();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="providerid"></param>
- /// <param name="_metadata0"></param>
- /// <param name="_person1"></param>
- /// <param name="_personrole2"></param>
- /// <param name="_ratingsource3"></param>
- public MetadataProviderId(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
- {
- // NOTE: This class has one-to-one associations with MetadataProviderId.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- if (string.IsNullOrEmpty(providerid))
+ if (string.IsNullOrEmpty(providerId))
{
- throw new ArgumentNullException(nameof(providerid));
+ throw new ArgumentNullException(nameof(providerId));
}
- this.ProviderId = providerid;
+ ProviderId = providerId;
- if (_metadata0 == null)
+ if (metadata == null)
{
- throw new ArgumentNullException(nameof(_metadata0));
+ throw new ArgumentNullException(nameof(metadata));
}
- _metadata0.Sources.Add(this);
-
- if (_person1 == null)
- {
- throw new ArgumentNullException(nameof(_person1));
- }
-
- _person1.Sources.Add(this);
-
- if (_personrole2 == null)
- {
- throw new ArgumentNullException(nameof(_personrole2));
- }
-
- _personrole2.Sources.Add(this);
-
- if (_ratingsource3 == null)
- {
- throw new ArgumentNullException(nameof(_ratingsource3));
- }
-
- _ratingsource3.Source = this;
-
- Init();
+ metadata.Sources.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MetadataProviderId"/> class.
/// </summary>
- /// <param name="providerid"></param>
- /// <param name="_metadata0"></param>
- /// <param name="_person1"></param>
- /// <param name="_personrole2"></param>
- /// <param name="_ratingsource3"></param>
- public static MetadataProviderId Create(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MetadataProviderId()
{
- return new MetadataProviderId(providerid, _metadata0, _person1, _personrole2, _ratingsource3);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for Id.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for ProviderId.
- /// </summary>
- protected string _ProviderId;
- /// <summary>
- /// When provided in a partial class, allows value of ProviderId to be changed before setting.
- /// </summary>
- partial void SetProviderId(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of ProviderId to be changed before returning.
- /// </summary>
- partial void GetProviderId(ref string result);
-
- /// <summary>
- /// Required, Max length = 255
+ /// Gets or sets the provider id.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 255.
+ /// </remarks>
[Required]
[MaxLength(255)]
[StringLength(255)]
- public string ProviderId
- {
- get
- {
- string value = _ProviderId;
- GetProviderId(ref value);
- return _ProviderId = value;
- }
+ public string ProviderId { get; set; }
- set
- {
- string oldValue = _ProviderId;
- SetProviderId(oldValue, ref value);
- if (oldValue != value)
- {
- _ProviderId = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets the metadata provider.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ public virtual MetadataProvider MetadataProvider { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- /// <summary>
- /// Required.
- /// </summary>
- [ForeignKey("MetadataProvider_Id")]
- public virtual MetadataProvider MetadataProvider { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Movie.cs b/Jellyfin.Data/Entities/Libraries/Movie.cs
index e7d27b551..0a8cc83dd 100644
--- a/Jellyfin.Data/Entities/Libraries/Movie.cs
+++ b/Jellyfin.Data/Entities/Libraries/Movie.cs
@@ -1,72 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Movie : LibraryItem
+ /// <summary>
+ /// An entity representing a movie.
+ /// </summary>
+ public class Movie : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Movie"/> class.
/// </summary>
- protected Movie()
+ public Movie()
{
Releases = new HashSet<Release>();
MovieMetadata = new HashSet<MovieMetadata>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Movie CreateMovieUnsafe()
- {
- return new Movie();
}
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public Movie(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.Releases = new HashSet<Release>();
- this.MovieMetadata = new HashSet<MovieMetadata>();
-
- Init();
- }
+ /// <inheritdoc />
+ public virtual ICollection<Release> Releases { get; protected set; }
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets a collection containing the metadata for this movie.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static Movie Create(Guid urlid, DateTime dateadded)
- {
- return new Movie(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Release_Releases_Id")]
- public virtual ICollection<Release> Releases { get; protected set; }
-
- [ForeignKey("MovieMetadata_MovieMetadata_Id")]
public virtual ICollection<MovieMetadata> MovieMetadata { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
index f65da11d2..31102bf13 100644
--- a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
@@ -1,244 +1,85 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MovieMetadata : Metadata
+ /// <summary>
+ /// An entity holding the metadata for a movie.
+ /// </summary>
+ public class MovieMetadata : Metadata, IHasCompanies
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="MovieMetadata"/> class.
/// </summary>
- protected MovieMetadata()
- {
- Studios = new HashSet<Company>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MovieMetadata CreateMovieMetadataUnsafe()
- {
- return new MovieMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="title">The title or name of the object.</param>
+ /// <param name="title">The title or name of the movie.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_movie0"></param>
- public MovieMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
+ /// <param name="movie">The movie.</param>
+ public MovieMetadata(string title, string language, Movie movie) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_movie0 == null)
- {
- throw new ArgumentNullException(nameof(_movie0));
- }
-
- _movie0.MovieMetadata.Add(this);
-
- this.Studios = new HashSet<Company>();
+ Studios = new HashSet<Company>();
- Init();
+ movie.MovieMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MovieMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_movie0"></param>
- public static MovieMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MovieMetadata()
{
- return new MovieMetadata(title, language, dateadded, datemodified, _movie0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Outline.
- /// </summary>
- protected string _Outline;
/// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- /// </summary>
- partial void SetOutline(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- /// </summary>
- partial void GetOutline(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the outline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
+ public string Outline { get; set; }
/// <summary>
- /// Backing field for Plot.
- /// </summary>
- protected string _Plot;
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before setting.
- /// </summary>
- partial void SetPlot(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before returning.
- /// </summary>
- partial void GetPlot(ref string result);
-
- /// <summary>
- /// Max length = 65535
- /// </summary>
- [MaxLength(65535)]
- [StringLength(65535)]
- public string Plot
- {
- get
- {
- string value = _Plot;
- GetPlot(ref value);
- return _Plot = value;
- }
-
- set
- {
- string oldValue = _Plot;
- SetPlot(oldValue, ref value);
- if (oldValue != value)
- {
- _Plot = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Tagline.
- /// </summary>
- protected string _Tagline;
- /// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before setting.
- /// </summary>
- partial void SetTagline(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before returning.
- /// </summary>
- partial void GetTagline(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the tagline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline
- {
- get
- {
- string value = _Tagline;
- GetTagline(ref value);
- return _Tagline = value;
- }
-
- set
- {
- string oldValue = _Tagline;
- SetTagline(oldValue, ref value);
- if (oldValue != value)
- {
- _Tagline = value;
- }
- }
- }
+ public string Tagline { get; set; }
/// <summary>
- /// Backing field for Country.
- /// </summary>
- protected string _Country;
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before setting.
- /// </summary>
- partial void SetCountry(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before returning.
+ /// Gets or sets the plot.
/// </summary>
- partial void GetCountry(ref string result);
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
+ [MaxLength(65535)]
+ [StringLength(65535)]
+ public string Plot { get; set; }
/// <summary>
- /// Max length = 2
+ /// Gets or sets the country code.
/// </summary>
+ /// <remarks>
+ /// Max length = 2.
+ /// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
-
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
+ public string Country { get; set; }
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("Company_Studios_Id")]
+ /// <summary>
+ /// Gets or sets the studios that produced this movie.
+ /// </summary>
public virtual ICollection<Company> Studios { get; protected set; }
+
+ /// <inheritdoc />
+ [NotMapped]
+ public ICollection<Company> Companies => Studios;
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
index 52776b12e..2ed1f78c5 100644
--- a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
+++ b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
@@ -1,71 +1,29 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MusicAlbum : LibraryItem
+ /// <summary>
+ /// An entity representing a music album.
+ /// </summary>
+ public class MusicAlbum : LibraryItem
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="MusicAlbum"/> class.
/// </summary>
- protected MusicAlbum()
+ public MusicAlbum()
{
MusicAlbumMetadata = new HashSet<MusicAlbumMetadata>();
Tracks = new HashSet<Track>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MusicAlbum CreateMusicAlbumUnsafe()
- {
- return new MusicAlbum();
}
/// <summary>
- /// Public constructor with required data.
+ /// Gets or sets a collection containing the album metadata.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public MusicAlbum(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.MusicAlbumMetadata = new HashSet<MusicAlbumMetadata>();
- this.Tracks = new HashSet<Track>();
-
- Init();
- }
+ public virtual ICollection<MusicAlbumMetadata> MusicAlbumMetadata { get; protected set; }
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets a collection containing the tracks.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static MusicAlbum Create(Guid urlid, DateTime dateadded)
- {
- return new MusicAlbum(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("MusicAlbumMetadata_MusicAlbumMetadata_Id")]
- public virtual ICollection<MusicAlbumMetadata> MusicAlbumMetadata { get; protected set; }
-
- [ForeignKey("Track_Tracks_Id")]
public virtual ICollection<Track> Tracks { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs
index f2480a5c5..cc5919bfe 100644
--- a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs
@@ -1,207 +1,69 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MusicAlbumMetadata : Metadata
+ /// <summary>
+ /// An entity holding the metadata for a music album.
+ /// </summary>
+ public class MusicAlbumMetadata : Metadata
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected MusicAlbumMetadata()
- {
- Labels = new HashSet<Company>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static MusicAlbumMetadata CreateMusicAlbumMetadataUnsafe()
- {
- return new MusicAlbumMetadata();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="MusicAlbumMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
+ /// <param name="title">The title or name of the album.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_musicalbum0"></param>
- public MusicAlbumMetadata(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
+ /// <param name="album">The music album.</param>
+ public MusicAlbumMetadata(string title, string language, MusicAlbum album) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_musicalbum0 == null)
- {
- throw new ArgumentNullException(nameof(_musicalbum0));
- }
-
- _musicalbum0.MusicAlbumMetadata.Add(this);
-
- this.Labels = new HashSet<Company>();
+ Labels = new HashSet<Company>();
- Init();
+ album.MusicAlbumMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="MusicAlbumMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_musicalbum0"></param>
- public static MusicAlbumMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, MusicAlbum _musicalbum0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected MusicAlbumMetadata()
{
- return new MusicAlbumMetadata(title, language, dateadded, datemodified, _musicalbum0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Barcode.
- /// </summary>
- protected string _Barcode;
- /// <summary>
- /// When provided in a partial class, allows value of Barcode to be changed before setting.
- /// </summary>
- partial void SetBarcode(string oldValue, ref string newValue);
/// <summary>
- /// When provided in a partial class, allows value of Barcode to be changed before returning.
- /// </summary>
- partial void GetBarcode(ref string result);
-
- /// <summary>
- /// Max length = 255
+ /// Gets or sets the barcode.
/// </summary>
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string Barcode
- {
- get
- {
- string value = _Barcode;
- GetBarcode(ref value);
- return _Barcode = value;
- }
+ public string Barcode { get; set; }
- set
- {
- string oldValue = _Barcode;
- SetBarcode(oldValue, ref value);
- if (oldValue != value)
- {
- _Barcode = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for LabelNumber.
- /// </summary>
- protected string _LabelNumber;
/// <summary>
- /// When provided in a partial class, allows value of LabelNumber to be changed before setting.
- /// </summary>
- partial void SetLabelNumber(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of LabelNumber to be changed before returning.
- /// </summary>
- partial void GetLabelNumber(ref string result);
-
- /// <summary>
- /// Max length = 255
+ /// Gets or sets the label number.
/// </summary>
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string LabelNumber
- {
- get
- {
- string value = _LabelNumber;
- GetLabelNumber(ref value);
- return _LabelNumber = value;
- }
-
- set
- {
- string oldValue = _LabelNumber;
- SetLabelNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _LabelNumber = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Country.
- /// </summary>
- protected string _Country;
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before setting.
- /// </summary>
- partial void SetCountry(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before returning.
- /// </summary>
- partial void GetCountry(ref string result);
+ public string LabelNumber { get; set; }
/// <summary>
- /// Max length = 2
+ /// Gets or sets the country code.
/// </summary>
+ /// <remarks>
+ /// Max length = 2.
+ /// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
-
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Country { get; set; }
- [ForeignKey("Company_Labels_Id")]
+ /// <summary>
+ /// Gets or sets a collection containing the labels.
+ /// </summary>
public virtual ICollection<Company> Labels { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Person.cs b/Jellyfin.Data/Entities/Libraries/Person.cs
index f325a07ff..8beb3dd08 100644
--- a/Jellyfin.Data/Entities/Libraries/Person.cs
+++ b/Jellyfin.Data/Entities/Libraries/Person.cs
@@ -1,317 +1,103 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Person
+ /// <summary>
+ /// An entity representing a person.
+ /// </summary>
+ public class Person : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Person()
- {
- Sources = new HashSet<MetadataProviderId>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Person CreatePersonUnsafe()
- {
- return new Person();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="Person"/> class.
/// </summary>
- /// <param name="urlid"></param>
- /// <param name="name"></param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- public Person(Guid urlid, string name, DateTime dateadded, DateTime datemodified)
+ /// <param name="name">The name of the person.</param>
+ public Person(string name)
{
- this.UrlId = urlid;
-
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
-
- this.Sources = new HashSet<MetadataProviderId>();
+ Name = name;
+ DateAdded = DateTime.UtcNow;
+ DateModified = DateAdded;
- Init();
+ Sources = new HashSet<MetadataProviderId>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Person"/> class.
/// </summary>
- /// <param name="urlid"></param>
- /// <param name="name"></param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- public static Person Create(Guid urlid, string name, DateTime dateadded, DateTime datemodified)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Person()
{
- return new Person(urlid, name, dateadded, datemodified);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for UrlId.
- /// </summary>
- protected Guid _UrlId;
- /// <summary>
- /// When provided in a partial class, allows value of UrlId to be changed before setting.
- /// </summary>
- partial void SetUrlId(Guid oldValue, ref Guid newValue);
- /// <summary>
- /// When provided in a partial class, allows value of UrlId to be changed before returning.
- /// </summary>
- partial void GetUrlId(ref Guid result);
-
- /// <summary>
- /// Required.
- /// </summary>
- [Required]
- public Guid UrlId
- {
- get
- {
- Guid value = _UrlId;
- GetUrlId(ref value);
- return _UrlId = value;
- }
-
- set
- {
- Guid oldValue = _UrlId;
- SetUrlId(oldValue, ref value);
- if (oldValue != value)
- {
- _UrlId = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Required, Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 1024.
+ /// </remarks>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ public string Name { get; set; }
/// <summary>
- /// Backing field for SourceId.
- /// </summary>
- protected string _SourceId;
- /// <summary>
- /// When provided in a partial class, allows value of SourceId to be changed before setting.
- /// </summary>
- partial void SetSourceId(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of SourceId to be changed before returning.
+ /// Gets or sets the source id.
/// </summary>
- partial void GetSourceId(ref string result);
+ /// <remarks>
+ /// Max length = 255.
+ /// </remarks>
+ [MaxLength(256)]
+ [StringLength(256)]
+ public string SourceId { get; set; }
/// <summary>
- /// Max length = 255
+ /// Gets or sets the date added.
/// </summary>
- [MaxLength(255)]
- [StringLength(255)]
- public string SourceId
- {
- get
- {
- string value = _SourceId;
- GetSourceId(ref value);
- return _SourceId = value;
- }
-
- set
- {
- string oldValue = _SourceId;
- SetSourceId(oldValue, ref value);
- if (oldValue != value)
- {
- _SourceId = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for DateAdded.
- /// </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>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public DateTime DateAdded
- {
- get
- {
- DateTime value = _DateAdded;
- GetDateAdded(ref value);
- return _DateAdded = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateAdded;
- SetDateAdded(oldValue, ref value);
- if (oldValue != value)
- {
- _DateAdded = value;
- }
- }
- }
+ /// </remarks>
+ public DateTime DateAdded { get; protected set; }
/// <summary>
- /// Backing field for DateModified.
+ /// Gets or sets the date modified.
/// </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>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public DateTime DateModified
- {
- get
- {
- DateTime value = _DateModified;
- GetDateModified(ref value);
- return _DateModified = value;
- }
+ /// </remarks>
+ public DateTime DateModified { get; set; }
- internal set
- {
- DateTime oldValue = _DateModified;
- SetDateModified(oldValue, ref value);
- if (oldValue != value)
- {
- _DateModified = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a list of metadata sources for this person.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("MetadataProviderId_Sources_Id")]
- public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/PersonRole.cs b/Jellyfin.Data/Entities/Libraries/PersonRole.cs
index 04d50deaf..5290228d6 100644
--- a/Jellyfin.Data/Entities/Libraries/PersonRole.cs
+++ b/Jellyfin.Data/Entities/Libraries/PersonRole.cs
@@ -1,217 +1,98 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class PersonRole
+ /// <summary>
+ /// An entity representing a person's role in media.
+ /// </summary>
+ public class PersonRole : IHasArtwork, IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="PersonRole"/> class.
/// </summary>
- protected PersonRole()
+ /// <param name="type">The role type.</param>
+ /// <param name="metadata">The metadata.</param>
+ public PersonRole(PersonRoleType type, Metadata metadata)
{
- // NOTE: This class has one-to-one associations with PersonRole.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Sources = new HashSet<MetadataProviderId>();
+ Type = type;
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static PersonRole CreatePersonRoleUnsafe()
- {
- return new PersonRole();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="type"></param>
- /// <param name="_metadata0"></param>
- public PersonRole(Enums.PersonRoleType type, Metadata _metadata0)
- {
- // NOTE: This class has one-to-one associations with PersonRole.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- this.Type = type;
-
- if (_metadata0 == null)
+ if (metadata == null)
{
- throw new ArgumentNullException(nameof(_metadata0));
+ throw new ArgumentNullException(nameof(metadata));
}
- _metadata0.PersonRoles.Add(this);
-
- this.Sources = new HashSet<MetadataProviderId>();
+ metadata.PersonRoles.Add(this);
- Init();
+ Sources = new HashSet<MetadataProviderId>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="PersonRole"/> class.
/// </summary>
- /// <param name="type"></param>
- /// <param name="_metadata0"></param>
- public static PersonRole Create(Enums.PersonRoleType type, Metadata _metadata0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected PersonRole()
{
- return new PersonRole(type, _metadata0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Role.
- /// </summary>
- protected string _Role;
- /// <summary>
- /// When provided in a partial class, allows value of Role to be changed before setting.
- /// </summary>
- partial void SetRole(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Role to be changed before returning.
- /// </summary>
- partial void GetRole(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Max length = 1024
+ /// Gets or sets the name of the person's role.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Role
- {
- get
- {
- string value = _Role;
- GetRole(ref value);
- return _Role = value;
- }
-
- set
- {
- string oldValue = _Role;
- SetRole(oldValue, ref value);
- if (oldValue != value)
- {
- _Role = value;
- }
- }
- }
+ public string Role { get; set; }
/// <summary>
- /// Backing field for Type.
+ /// Gets or sets the person's role type.
/// </summary>
- protected Enums.PersonRoleType _Type;
- /// <summary>
- /// When provided in a partial class, allows value of Type to be changed before setting.
- /// </summary>
- partial void SetType(Enums.PersonRoleType oldValue, ref Enums.PersonRoleType newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Type to be changed before returning.
- /// </summary>
- partial void GetType(ref Enums.PersonRoleType result);
+ /// <remarks>
+ /// Required.
+ /// </remarks>
+ public PersonRoleType Type { get; set; }
+
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; protected set; }
/// <summary>
- /// Required.
+ /// Gets or sets the person.
/// </summary>
+ /// <remarks>
+ /// Required.
+ /// </remarks>
[Required]
- public Enums.PersonRoleType Type
- {
- get
- {
- Enums.PersonRoleType value = _Type;
- GetType(ref value);
- return _Type = value;
- }
+ public virtual Person Person { get; set; }
- set
- {
- Enums.PersonRoleType oldValue = _Type;
- SetType(oldValue, ref value);
- if (oldValue != value)
- {
- _Type = value;
- }
- }
- }
+ /// <inheritdoc />
+ public virtual ICollection<Artwork> Artwork { get; protected set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a collection containing the metadata sources for this person role.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- /// <summary>
- /// Required.
- /// </summary>
- [ForeignKey("Person_Id")]
-
- public virtual Person Person { get; set; }
-
- [ForeignKey("Artwork_Artwork_Id")]
- public virtual Artwork Artwork { get; set; }
-
- [ForeignKey("MetadataProviderId_Sources_Id")]
- public virtual ICollection<MetadataProviderId> Sources { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Photo.cs b/Jellyfin.Data/Entities/Libraries/Photo.cs
index 01c39b3ea..44338a4ce 100644
--- a/Jellyfin.Data/Entities/Libraries/Photo.cs
+++ b/Jellyfin.Data/Entities/Libraries/Photo.cs
@@ -1,71 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Photo : LibraryItem
+ /// <summary>
+ /// An entity representing a photo.
+ /// </summary>
+ public class Photo : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Photo"/> class.
/// </summary>
- protected Photo()
+ public Photo()
{
PhotoMetadata = new HashSet<PhotoMetadata>();
Releases = new HashSet<Release>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Photo CreatePhotoUnsafe()
- {
- return new Photo();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public Photo(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.PhotoMetadata = new HashSet<PhotoMetadata>();
- this.Releases = new HashSet<Release>();
-
- Init();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets a collection containing the photo metadata.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static Photo Create(Guid urlid, DateTime dateadded)
- {
- return new Photo(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("PhotoMetadata_PhotoMetadata_Id")]
public virtual ICollection<PhotoMetadata> PhotoMetadata { get; protected set; }
- [ForeignKey("Release_Releases_Id")]
+ /// <inheritdoc />
public virtual ICollection<Release> Releases { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs b/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs
index 701623fd1..1ef9dd5f9 100644
--- a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs
@@ -1,83 +1,36 @@
-#pragma warning disable CS1591
-
using System;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class PhotoMetadata : Metadata
+ /// <summary>
+ /// An entity that holds metadata for a photo.
+ /// </summary>
+ public class PhotoMetadata : Metadata
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="PhotoMetadata"/> class.
/// </summary>
- protected PhotoMetadata()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static PhotoMetadata CreatePhotoMetadataUnsafe()
- {
- return new PhotoMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="title">The title or name of the object.</param>
+ /// <param name="title">The title or name of the photo.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_photo0"></param>
- public PhotoMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
+ /// <param name="photo">The photo.</param>
+ public PhotoMetadata(string title, string language, Photo photo) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
+ if (photo == null)
{
- throw new ArgumentNullException(nameof(title));
+ throw new ArgumentNullException(nameof(photo));
}
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_photo0 == null)
- {
- throw new ArgumentNullException(nameof(_photo0));
- }
-
- _photo0.PhotoMetadata.Add(this);
-
- Init();
+ photo.PhotoMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="PhotoMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_photo0"></param>
- public static PhotoMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Photo _photo0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected PhotoMetadata()
{
- return new PhotoMetadata(title, language, dateadded, datemodified, _photo0);
}
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Rating.cs b/Jellyfin.Data/Entities/Libraries/Rating.cs
index 31bee165a..ba054a39e 100644
--- a/Jellyfin.Data/Entities/Libraries/Rating.cs
+++ b/Jellyfin.Data/Entities/Libraries/Rating.cs
@@ -1,194 +1,78 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Rating
+ /// <summary>
+ /// An entity representing a rating for an entity.
+ /// </summary>
+ public class Rating : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
- protected Rating()
+ /// <param name="value">The value.</param>
+ /// <param name="metadata">The metadata.</param>
+ public Rating(double value, Metadata metadata)
{
- Init();
- }
+ Value = value;
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Rating CreateRatingUnsafe()
- {
- return new Rating();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="value"></param>
- /// <param name="_metadata0"></param>
- public Rating(double value, Metadata _metadata0)
- {
- this.Value = value;
-
- if (_metadata0 == null)
+ if (metadata == null)
{
- throw new ArgumentNullException(nameof(_metadata0));
+ throw new ArgumentNullException(nameof(metadata));
}
- _metadata0.Ratings.Add(this);
-
- Init();
+ metadata.Ratings.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
- /// <param name="value"></param>
- /// <param name="_metadata0"></param>
- public static Rating Create(double value, Metadata _metadata0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Rating()
{
- return new Rating(value, _metadata0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </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.
+ /// Gets or sets the id.
/// </summary>
- partial void GetId(ref int result);
-
- /// <summary>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
/// <summary>
- /// Backing field for Value.
- /// </summary>
- protected double _Value;
- /// <summary>
- /// When provided in a partial class, allows value of Value to be changed before setting.
+ /// Gets or sets the value.
/// </summary>
- partial void SetValue(double oldValue, ref double newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Value to be changed before returning.
- /// </summary>
- partial void GetValue(ref double result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public double Value
- {
- get
- {
- double value = _Value;
- GetValue(ref value);
- return _Value = value;
- }
+ /// </remarks>
+ public double Value { get; set; }
- set
- {
- double oldValue = _Value;
- SetValue(oldValue, ref value);
- if (oldValue != value)
- {
- _Value = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Votes.
- /// </summary>
- protected int? _Votes;
- /// <summary>
- /// When provided in a partial class, allows value of Votes to be changed before setting.
- /// </summary>
- partial void SetVotes(int? oldValue, ref int? newValue);
/// <summary>
- /// When provided in a partial class, allows value of Votes to be changed before returning.
+ /// Gets or sets the number of votes.
/// </summary>
- partial void GetVotes(ref int? result);
-
- public int? Votes
- {
- get
- {
- int? value = _Votes;
- GetVotes(ref value);
- return _Votes = value;
- }
+ public int? Votes { get; set; }
- set
- {
- int? oldValue = _Votes;
- SetVotes(oldValue, ref value);
- if (oldValue != value)
- {
- _Votes = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets the rating type.
+ /// If this is <c>null</c> it's the internal user rating.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual RatingSource RatingType { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- /// <summary>
- /// If this is NULL it&apos;s the internal user rating.
- /// </summary>
- [ForeignKey("RatingSource_RatingType_Id")]
- public virtual RatingSource RatingType { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/RatingSource.cs b/Jellyfin.Data/Entities/Libraries/RatingSource.cs
index 8204e9ff2..549f41804 100644
--- a/Jellyfin.Data/Entities/Libraries/RatingSource.cs
+++ b/Jellyfin.Data/Entities/Libraries/RatingSource.cs
@@ -1,239 +1,92 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
/// <summary>
/// This is the entity to store review ratings, not age ratings.
/// </summary>
- public partial class RatingSource
+ public class RatingSource : IHasConcurrencyToken
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="RatingSource"/> class.
/// </summary>
- protected RatingSource()
+ /// <param name="minimumValue">The minimum value.</param>
+ /// <param name="maximumValue">The maximum value.</param>
+ /// <param name="rating">The rating.</param>
+ public RatingSource(double minimumValue, double maximumValue, Rating rating)
{
- Init();
- }
+ MinimumValue = minimumValue;
+ MaximumValue = maximumValue;
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static RatingSource CreateRatingSourceUnsafe()
- {
- return new RatingSource();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="maximumvalue"></param>
- /// <param name="minimumvalue"></param>
- /// <param name="_rating0"></param>
- public RatingSource(double maximumvalue, double minimumvalue, Rating _rating0)
- {
- this.MaximumValue = maximumvalue;
-
- this.MinimumValue = minimumvalue;
-
- if (_rating0 == null)
+ if (rating == null)
{
- throw new ArgumentNullException(nameof(_rating0));
+ throw new ArgumentNullException(nameof(rating));
}
- _rating0.RatingType = this;
-
- Init();
+ rating.RatingType = this;
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="RatingSource"/> class.
/// </summary>
- /// <param name="maximumvalue"></param>
- /// <param name="minimumvalue"></param>
- /// <param name="_rating0"></param>
- public static RatingSource Create(double maximumvalue, double minimumvalue, Rating _rating0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected RatingSource()
{
- return new RatingSource(maximumvalue, minimumvalue, _rating0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ public string Name { get; set; }
/// <summary>
- /// Backing field for MaximumValue.
+ /// Gets or sets the minimum value.
/// </summary>
- protected double _MaximumValue;
- /// <summary>
- /// When provided in a partial class, allows value of MaximumValue to be changed before setting.
- /// </summary>
- partial void SetMaximumValue(double oldValue, ref double newValue);
- /// <summary>
- /// When provided in a partial class, allows value of MaximumValue to be changed before returning.
- /// </summary>
- partial void GetMaximumValue(ref double result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public double MaximumValue
- {
- get
- {
- double value = _MaximumValue;
- GetMaximumValue(ref value);
- return _MaximumValue = value;
- }
-
- set
- {
- double oldValue = _MaximumValue;
- SetMaximumValue(oldValue, ref value);
- if (oldValue != value)
- {
- _MaximumValue = value;
- }
- }
- }
+ /// </remarks>
+ public double MinimumValue { get; set; }
/// <summary>
- /// Backing field for MinimumValue.
+ /// Gets or sets the maximum value.
/// </summary>
- protected double _MinimumValue;
- /// <summary>
- /// When provided in a partial class, allows value of MinimumValue to be changed before setting.
- /// </summary>
- partial void SetMinimumValue(double oldValue, ref double newValue);
- /// <summary>
- /// When provided in a partial class, allows value of MinimumValue to be changed before returning.
- /// </summary>
- partial void GetMinimumValue(ref double result);
-
- /// <summary>
+ /// <remarks>
/// Required.
- /// </summary>
- [Required]
- public double MinimumValue
- {
- get
- {
- double value = _MinimumValue;
- GetMinimumValue(ref value);
- return _MinimumValue = value;
- }
+ /// </remarks>
+ public double MaximumValue { get; set; }
- set
- {
- double oldValue = _MinimumValue;
- SetMinimumValue(oldValue, ref value);
- if (oldValue != value)
- {
- _MinimumValue = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets the metadata source.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual MetadataProviderId Source { get; set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("MetadataProviderId_Source_Id")]
- public virtual MetadataProviderId Source { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Release.cs b/Jellyfin.Data/Entities/Libraries/Release.cs
index 4b42d65ec..43c7080d7 100644
--- a/Jellyfin.Data/Entities/Libraries/Release.cs
+++ b/Jellyfin.Data/Entities/Libraries/Release.cs
@@ -1,219 +1,84 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Release
+ /// <summary>
+ /// An entity representing a release for a library item, eg. Director's cut vs. standard.
+ /// </summary>
+ public class Release : IHasConcurrencyToken
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected Release()
- {
- MediaFiles = new HashSet<MediaFile>();
- Chapters = new HashSet<Chapter>();
-
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the <see cref="Release"/> class.
/// </summary>
- public static Release CreateReleaseUnsafe()
- {
- return new Release();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="name"></param>
- /// <param name="_movie0"></param>
- /// <param name="_episode1"></param>
- /// <param name="_track2"></param>
- /// <param name="_customitem3"></param>
- /// <param name="_book4"></param>
- /// <param name="_photo5"></param>
- public Release(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
+ /// <param name="name">The name of this release.</param>
+ /// <param name="owner">The owner of this release.</param>
+ public Release(string name, IHasReleases owner)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
+ Name = name;
- if (_movie0 == null)
- {
- throw new ArgumentNullException(nameof(_movie0));
- }
-
- _movie0.Releases.Add(this);
-
- if (_episode1 == null)
- {
- throw new ArgumentNullException(nameof(_episode1));
- }
+ owner?.Releases.Add(this);
- _episode1.Releases.Add(this);
-
- if (_track2 == null)
- {
- throw new ArgumentNullException(nameof(_track2));
- }
-
- _track2.Releases.Add(this);
-
- if (_customitem3 == null)
- {
- throw new ArgumentNullException(nameof(_customitem3));
- }
-
- _customitem3.Releases.Add(this);
-
- if (_book4 == null)
- {
- throw new ArgumentNullException(nameof(_book4));
- }
-
- _book4.Releases.Add(this);
-
- if (_photo5 == null)
- {
- throw new ArgumentNullException(nameof(_photo5));
- }
-
- _photo5.Releases.Add(this);
-
- this.MediaFiles = new HashSet<MediaFile>();
- this.Chapters = new HashSet<Chapter>();
-
- Init();
+ MediaFiles = new HashSet<MediaFile>();
+ Chapters = new HashSet<Chapter>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Release"/> class.
/// </summary>
- /// <param name="name"></param>
- /// <param name="_movie0"></param>
- /// <param name="_episode1"></param>
- /// <param name="_track2"></param>
- /// <param name="_customitem3"></param>
- /// <param name="_book4"></param>
- /// <param name="_photo5"></param>
- public static Release Create(string name, Movie _movie0, Episode _episode1, Track _track2, CustomItem _customitem3, Book _book4, Photo _photo5)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Release()
{
- return new Release(name, _movie0, _episode1, _track2, _customitem3, _book4, _photo5);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Id.
- /// </summary>
- internal int _Id;
/// <summary>
- /// When provided in a partial class, allows value of Id to be changed before setting.
+ /// Gets or sets the id.
/// </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>
+ /// <remarks>
/// Identity, Indexed, Required.
- /// </summary>
- [Key]
- [Required]
+ /// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Name.
- /// </summary>
- protected string _Name;
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before setting.
- /// </summary>
- partial void SetName(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Name to be changed before returning.
- /// </summary>
- partial void GetName(ref string result);
+ public int Id { get; protected set; }
/// <summary>
- /// Required, Max length = 1024
+ /// Gets or sets the name.
/// </summary>
+ /// <remarks>
+ /// Required, Max length = 1024.
+ /// </remarks>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ /// <inheritdoc />
+ [ConcurrencyCheck]
+ public uint RowVersion { get; set; }
/// <summary>
- /// Required, ConcurrenyToken.
+ /// Gets or sets a collection containing the media files for this release.
/// </summary>
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public virtual ICollection<MediaFile> MediaFiles { get; protected set; }
+
+ /// <summary>
+ /// Gets or sets a collection containing the chapters for this release.
+ /// </summary>
+ public virtual ICollection<Chapter> Chapters { get; protected set; }
+ /// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("MediaFile_MediaFiles_Id")]
- public virtual ICollection<MediaFile> MediaFiles { get; protected set; }
-
- [ForeignKey("Chapter_Chapters_Id")]
- public virtual ICollection<Chapter> Chapters { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Season.cs b/Jellyfin.Data/Entities/Libraries/Season.cs
index 90885f0e9..eef788bad 100644
--- a/Jellyfin.Data/Entities/Libraries/Season.cs
+++ b/Jellyfin.Data/Entities/Libraries/Season.cs
@@ -1,119 +1,53 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Season : LibraryItem
+ /// <summary>
+ /// An entity representing a season.
+ /// </summary>
+ public class Season : LibraryItem
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Season"/> class.
/// </summary>
- protected Season()
+ /// <param name="series">The series.</param>
+ public Season(Series series)
{
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- SeasonMetadata = new HashSet<SeasonMetadata>();
- Episodes = new HashSet<Episode>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Season CreateSeasonUnsafe()
- {
- return new Season();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_series0"></param>
- public Season(Guid urlid, DateTime dateadded, Series _series0)
- {
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- this.UrlId = urlid;
-
- if (_series0 == null)
+ if (series == null)
{
- throw new ArgumentNullException(nameof(_series0));
+ throw new ArgumentNullException(nameof(series));
}
- _series0.Seasons.Add(this);
-
- this.SeasonMetadata = new HashSet<SeasonMetadata>();
- this.Episodes = new HashSet<Episode>();
+ series.Seasons.Add(this);
- Init();
+ Episodes = new HashSet<Episode>();
+ SeasonMetadata = new HashSet<SeasonMetadata>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Season"/> class.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_series0"></param>
- public static Season Create(Guid urlid, DateTime dateadded, Series _series0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Season()
{
- return new Season(urlid, dateadded, _series0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for SeasonNumber.
+ /// Gets or sets the season number.
/// </summary>
- protected int? _SeasonNumber;
- /// <summary>
- /// When provided in a partial class, allows value of SeasonNumber to be changed before setting.
- /// </summary>
- partial void SetSeasonNumber(int? oldValue, ref int? newValue);
+ public int? SeasonNumber { get; set; }
+
/// <summary>
- /// When provided in a partial class, allows value of SeasonNumber to be changed before returning.
+ /// Gets or sets the season metadata.
/// </summary>
- partial void GetSeasonNumber(ref int? result);
-
- public int? SeasonNumber
- {
- get
- {
- int? value = _SeasonNumber;
- GetSeasonNumber(ref value);
- return _SeasonNumber = value;
- }
-
- set
- {
- int? oldValue = _SeasonNumber;
- SetSeasonNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _SeasonNumber = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("SeasonMetadata_SeasonMetadata_Id")]
public virtual ICollection<SeasonMetadata> SeasonMetadata { get; protected set; }
- [ForeignKey("Episode_Episodes_Id")]
+ /// <summary>
+ /// Gets or sets a collection containing the number of episodes.
+ /// </summary>
public virtual ICollection<Episode> Episodes { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs
index 28105fe2c..eedeb089e 100644
--- a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs
@@ -1,122 +1,47 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class SeasonMetadata : Metadata
+ /// <summary>
+ /// An entity that holds metadata for seasons.
+ /// </summary>
+ public class SeasonMetadata : Metadata
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected SeasonMetadata()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static SeasonMetadata CreateSeasonMetadataUnsafe()
- {
- return new SeasonMetadata();
- }
-
/// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="SeasonMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_season0"></param>
- public SeasonMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
+ /// <param name="season">The season.</param>
+ public SeasonMetadata(string title, string language, Season season) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_season0 == null)
+ if (season == null)
{
- throw new ArgumentNullException(nameof(_season0));
+ throw new ArgumentNullException(nameof(season));
}
- _season0.SeasonMetadata.Add(this);
-
- Init();
+ season.SeasonMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="SeasonMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_season0"></param>
- public static SeasonMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Season _season0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected SeasonMetadata()
{
- return new SeasonMetadata(title, language, dateadded, datemodified, _season0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Outline.
- /// </summary>
- protected string _Outline;
- /// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- /// </summary>
- partial void SetOutline(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- /// </summary>
- partial void GetOutline(ref string result);
-
/// <summary>
- /// Max length = 1024
+ /// Gets or sets the outline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Outline { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Series.cs b/Jellyfin.Data/Entities/Libraries/Series.cs
index a137f0f68..e959c1fe0 100644
--- a/Jellyfin.Data/Entities/Libraries/Series.cs
+++ b/Jellyfin.Data/Entities/Libraries/Series.cs
@@ -1,165 +1,46 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Series : LibraryItem
+ /// <summary>
+ /// An entity representing a a series.
+ /// </summary>
+ public class Series : LibraryItem
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Series"/> class.
/// </summary>
- protected Series()
+ public Series()
{
- SeriesMetadata = new HashSet<SeriesMetadata>();
+ DateAdded = DateTime.UtcNow;
Seasons = new HashSet<Season>();
-
- Init();
+ SeriesMetadata = new HashSet<SeriesMetadata>();
}
/// <summary>
- /// Public constructor with required data.
+ /// Gets or sets the days of week.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public Series(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.SeriesMetadata = new HashSet<SeriesMetadata>();
- this.Seasons = new HashSet<Season>();
-
- Init();
- }
+ public DayOfWeek? AirsDayOfWeek { get; set; }
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Gets or sets the time the show airs, ignore the date portion.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- public static Series Create(Guid urlid, DateTime dateadded)
- {
- return new Series(urlid, dateadded);
- }
+ public DateTimeOffset? AirsTime { get; set; }
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for AirsDayOfWeek.
- /// </summary>
- protected DayOfWeek? _AirsDayOfWeek;
/// <summary>
- /// When provided in a partial class, allows value of AirsDayOfWeek to be changed before setting.
+ /// Gets or sets the date the series first aired.
/// </summary>
- partial void SetAirsDayOfWeek(DayOfWeek? oldValue, ref DayOfWeek? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of AirsDayOfWeek to be changed before returning.
- /// </summary>
- partial void GetAirsDayOfWeek(ref DayOfWeek? result);
+ public DateTime? FirstAired { get; set; }
- public DayOfWeek? AirsDayOfWeek
- {
- get
- {
- DayOfWeek? value = _AirsDayOfWeek;
- GetAirsDayOfWeek(ref value);
- return _AirsDayOfWeek = value;
- }
-
- set
- {
- DayOfWeek? oldValue = _AirsDayOfWeek;
- SetAirsDayOfWeek(oldValue, ref value);
- if (oldValue != value)
- {
- _AirsDayOfWeek = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for AirsTime.
- /// </summary>
- protected DateTimeOffset? _AirsTime;
/// <summary>
- /// When provided in a partial class, allows value of AirsTime to be changed before setting.
+ /// Gets or sets a collection containing the series metadata.
/// </summary>
- partial void SetAirsTime(DateTimeOffset? oldValue, ref DateTimeOffset? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of AirsTime to be changed before returning.
- /// </summary>
- partial void GetAirsTime(ref DateTimeOffset? result);
-
- /// <summary>
- /// The time the show airs, ignore the date portion.
- /// </summary>
- public DateTimeOffset? AirsTime
- {
- get
- {
- DateTimeOffset? value = _AirsTime;
- GetAirsTime(ref value);
- return _AirsTime = value;
- }
-
- set
- {
- DateTimeOffset? oldValue = _AirsTime;
- SetAirsTime(oldValue, ref value);
- if (oldValue != value)
- {
- _AirsTime = value;
- }
- }
- }
+ public virtual ICollection<SeriesMetadata> SeriesMetadata { get; protected set; }
/// <summary>
- /// Backing field for FirstAired.
- /// </summary>
- protected DateTimeOffset? _FirstAired;
- /// <summary>
- /// When provided in a partial class, allows value of FirstAired to be changed before setting.
+ /// Gets or sets a collection containing the seasons.
/// </summary>
- partial void SetFirstAired(DateTimeOffset? oldValue, ref DateTimeOffset? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of FirstAired to be changed before returning.
- /// </summary>
- partial void GetFirstAired(ref DateTimeOffset? result);
-
- public DateTimeOffset? FirstAired
- {
- get
- {
- DateTimeOffset? value = _FirstAired;
- GetFirstAired(ref value);
- return _FirstAired = value;
- }
-
- set
- {
- DateTimeOffset? oldValue = _FirstAired;
- SetFirstAired(oldValue, ref value);
- if (oldValue != value)
- {
- _FirstAired = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("SeriesMetadata_SeriesMetadata_Id")]
- public virtual ICollection<SeriesMetadata> SeriesMetadata { get; protected set; }
-
- [ForeignKey("Season_Seasons_Id")]
public virtual ICollection<Season> Seasons { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs
index 6e61da1e6..898f3006d 100644
--- a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs
@@ -1,244 +1,91 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class SeriesMetadata : Metadata
+ /// <summary>
+ /// An entity representing series metadata.
+ /// </summary>
+ public class SeriesMetadata : Metadata, IHasCompanies
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected SeriesMetadata()
- {
- Networks = new HashSet<Company>();
-
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static SeriesMetadata CreateSeriesMetadataUnsafe()
- {
- return new SeriesMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_series0"></param>
- public SeriesMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
+ /// <param name="series">The series.</param>
+ public SeriesMetadata(string title, string language, Series series) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_series0 == null)
+ if (series == null)
{
- throw new ArgumentNullException(nameof(_series0));
+ throw new ArgumentNullException(nameof(series));
}
- _series0.SeriesMetadata.Add(this);
-
- this.Networks = new HashSet<Company>();
+ series.SeriesMetadata.Add(this);
- Init();
+ Networks = new HashSet<Company>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="SeriesMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_series0"></param>
- public static SeriesMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Series _series0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected SeriesMetadata()
{
- return new SeriesMetadata(title, language, dateadded, datemodified, _series0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for Outline.
- /// </summary>
- protected string _Outline;
- /// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- /// </summary>
- partial void SetOutline(string oldValue, ref string newValue);
/// <summary>
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- /// </summary>
- partial void GetOutline(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the outline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
+ public string Outline { get; set; }
/// <summary>
- /// Backing field for Plot.
- /// </summary>
- protected string _Plot;
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before setting.
- /// </summary>
- partial void SetPlot(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Plot to be changed before returning.
- /// </summary>
- partial void GetPlot(ref string result);
-
- /// <summary>
- /// Max length = 65535
+ /// Gets or sets the plot.
/// </summary>
+ /// <remarks>
+ /// Max length = 65535.
+ /// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot
- {
- get
- {
- string value = _Plot;
- GetPlot(ref value);
- return _Plot = value;
- }
+ public string Plot { get; set; }
- set
- {
- string oldValue = _Plot;
- SetPlot(oldValue, ref value);
- if (oldValue != value)
- {
- _Plot = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Tagline.
- /// </summary>
- protected string _Tagline;
/// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before setting.
- /// </summary>
- partial void SetTagline(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Tagline to be changed before returning.
- /// </summary>
- partial void GetTagline(ref string result);
-
- /// <summary>
- /// Max length = 1024
+ /// Gets or sets the tagline.
/// </summary>
+ /// <remarks>
+ /// Max length = 1024.
+ /// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline
- {
- get
- {
- string value = _Tagline;
- GetTagline(ref value);
- return _Tagline = value;
- }
-
- set
- {
- string oldValue = _Tagline;
- SetTagline(oldValue, ref value);
- if (oldValue != value)
- {
- _Tagline = value;
- }
- }
- }
-
- /// <summary>
- /// Backing field for Country.
- /// </summary>
- protected string _Country;
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before setting.
- /// </summary>
- partial void SetCountry(string oldValue, ref string newValue);
- /// <summary>
- /// When provided in a partial class, allows value of Country to be changed before returning.
- /// </summary>
- partial void GetCountry(ref string result);
+ public string Tagline { get; set; }
/// <summary>
- /// Max length = 2
+ /// Gets or sets the country code.
/// </summary>
+ /// <remarks>
+ /// Max length = 2.
+ /// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
+ public string Country { get; set; }
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("Company_Networks_Id")]
+ /// <summary>
+ /// Gets or sets a collection containing the networks.
+ /// </summary>
public virtual ICollection<Company> Networks { get; protected set; }
+
+ /// <inheritdoc />
+ [NotMapped]
+ public ICollection<Company> Companies => Networks;
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Track.cs b/Jellyfin.Data/Entities/Libraries/Track.cs
index cdcc22d71..09ce82a9b 100644
--- a/Jellyfin.Data/Entities/Libraries/Track.cs
+++ b/Jellyfin.Data/Entities/Libraries/Track.cs
@@ -1,120 +1,52 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Track : LibraryItem
+ /// <summary>
+ /// An entity representing a track.
+ /// </summary>
+ public class Track : LibraryItem, IHasReleases
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the <see cref="Track"/> class.
/// </summary>
- protected Track()
+ /// <param name="album">The album.</param>
+ public Track(MusicAlbum album)
{
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Releases = new HashSet<Release>();
- TrackMetadata = new HashSet<TrackMetadata>();
-
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static Track CreateTrackUnsafe()
- {
- return new Track();
- }
-
- /// <summary>
- /// Public constructor with required data.
- /// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_musicalbum0"></param>
- public Track(Guid urlid, DateTime dateadded, MusicAlbum _musicalbum0)
- {
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- this.UrlId = urlid;
-
- if (_musicalbum0 == null)
+ if (album == null)
{
- throw new ArgumentNullException(nameof(_musicalbum0));
+ throw new ArgumentNullException(nameof(album));
}
- _musicalbum0.Tracks.Add(this);
-
- this.Releases = new HashSet<Release>();
- this.TrackMetadata = new HashSet<TrackMetadata>();
+ album.Tracks.Add(this);
- Init();
+ Releases = new HashSet<Release>();
+ TrackMetadata = new HashSet<TrackMetadata>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="Track"/> class.
/// </summary>
- /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="_musicalbum0"></param>
- public static Track Create(Guid urlid, DateTime dateadded, MusicAlbum _musicalbum0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected Track()
{
- return new Track(urlid, dateadded, _musicalbum0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
/// <summary>
- /// Backing field for TrackNumber.
+ /// Gets or sets the track number.
/// </summary>
- protected int? _TrackNumber;
- /// <summary>
- /// When provided in a partial class, allows value of TrackNumber to be changed before setting.
- /// </summary>
- partial void SetTrackNumber(int? oldValue, ref int? newValue);
- /// <summary>
- /// When provided in a partial class, allows value of TrackNumber to be changed before returning.
- /// </summary>
- partial void GetTrackNumber(ref int? result);
+ public int? TrackNumber { get; set; }
- public int? TrackNumber
- {
- get
- {
- int? value = _TrackNumber;
- GetTrackNumber(ref value);
- return _TrackNumber = value;
- }
-
- set
- {
- int? oldValue = _TrackNumber;
- SetTrackNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _TrackNumber = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Release_Releases_Id")]
+ /// <inheritdoc />
public virtual ICollection<Release> Releases { get; protected set; }
- [ForeignKey("TrackMetadata_TrackMetadata_Id")]
+ /// <summary>
+ /// Gets or sets a collection containing the track metadata.
+ /// </summary>
public virtual ICollection<TrackMetadata> TrackMetadata { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs b/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs
index 5c356c768..048068a1a 100644
--- a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs
@@ -1,83 +1,36 @@
-#pragma warning disable CS1591
-
using System;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class TrackMetadata : Metadata
+ /// <summary>
+ /// An entity holding metadata for a track.
+ /// </summary>
+ public class TrackMetadata : Metadata
{
- partial void Init();
-
/// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected TrackMetadata()
- {
- Init();
- }
-
- /// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static TrackMetadata CreateTrackMetadataUnsafe()
- {
- return new TrackMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="TrackMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_track0"></param>
- public TrackMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
+ /// <param name="track">The track.</param>
+ public TrackMetadata(string title, string language, Track track) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_track0 == null)
+ if (track == null)
{
- throw new ArgumentNullException(nameof(_track0));
+ throw new ArgumentNullException(nameof(track));
}
- _track0.TrackMetadata.Add(this);
-
- Init();
+ track.TrackMetadata.Add(this);
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="TrackMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_track0"></param>
- public static TrackMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Track _track0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected TrackMetadata()
{
- return new TrackMetadata(title, language, dateadded, datemodified, _track0);
}
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Permission.cs b/Jellyfin.Data/Entities/Permission.cs
index af3270a88..c0f67f836 100644
--- a/Jellyfin.Data/Entities/Permission.cs
+++ b/Jellyfin.Data/Entities/Permission.cs
@@ -3,13 +3,14 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity representing whether the associated user has a specific permission.
/// </summary>
- public partial class Permission : ISavingChanges
+ public partial class Permission : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Permission"/> class.
diff --git a/Jellyfin.Data/Entities/Preference.cs b/Jellyfin.Data/Entities/Preference.cs
index 0ca9d7eff..1797f0a40 100644
--- a/Jellyfin.Data/Entities/Preference.cs
+++ b/Jellyfin.Data/Entities/Preference.cs
@@ -2,13 +2,14 @@ using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity representing a preference attached to a user or group.
/// </summary>
- public class Preference : ISavingChanges
+ public class Preference : IHasConcurrencyToken
{
/// <summary>
/// Initializes a new instance of the <see cref="Preference"/> class.
diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.cs
index 8c720d85b..7ea1f4498 100644
--- a/Jellyfin.Data/Entities/User.cs
+++ b/Jellyfin.Data/Entities/User.cs
@@ -8,13 +8,14 @@ using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
/// <summary>
/// An entity representing a user.
/// </summary>
- public partial class User : IHasPermissions, ISavingChanges
+ public partial class User : IHasPermissions, IHasConcurrencyToken
{
/// <summary>
/// The values being delimited here are Guids, so commas work as they do not appear in Guids.
diff --git a/Jellyfin.Data/ISavingChanges.cs b/Jellyfin.Data/ISavingChanges.cs
deleted file mode 100644
index f392dae6a..000000000
--- a/Jellyfin.Data/ISavingChanges.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma warning disable CS1591
-
-namespace Jellyfin.Data
-{
- public interface ISavingChanges
- {
- void OnSavingChanges();
- }
-}
diff --git a/Jellyfin.Data/Interfaces/IHasArtwork.cs b/Jellyfin.Data/Interfaces/IHasArtwork.cs
new file mode 100644
index 000000000..a4d9c54af
--- /dev/null
+++ b/Jellyfin.Data/Interfaces/IHasArtwork.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using Jellyfin.Data.Entities.Libraries;
+
+namespace Jellyfin.Data.Interfaces
+{
+ /// <summary>
+ /// An interface abstracting an entity that has artwork.
+ /// </summary>
+ public interface IHasArtwork
+ {
+ /// <summary>
+ /// Gets a collection containing this entity's artwork.
+ /// </summary>
+ ICollection<Artwork> Artwork { get; }
+ }
+}
diff --git a/Jellyfin.Data/Interfaces/IHasCompanies.cs b/Jellyfin.Data/Interfaces/IHasCompanies.cs
new file mode 100644
index 000000000..8f19ce04f
--- /dev/null
+++ b/Jellyfin.Data/Interfaces/IHasCompanies.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using Jellyfin.Data.Entities.Libraries;
+
+namespace Jellyfin.Data.Interfaces
+{
+ /// <summary>
+ /// An abstraction representing an entity that has companies.
+ /// </summary>
+ public interface IHasCompanies
+ {
+ /// <summary>
+ /// Gets a collection containing this entity's companies.
+ /// </summary>
+ ICollection<Company> Companies { get; }
+ }
+}
diff --git a/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs b/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs
new file mode 100644
index 000000000..2c4091493
--- /dev/null
+++ b/Jellyfin.Data/Interfaces/IHasConcurrencyToken.cs
@@ -0,0 +1,18 @@
+namespace Jellyfin.Data.Interfaces
+{
+ /// <summary>
+ /// An interface abstracting an entity that has a concurrency token.
+ /// </summary>
+ public interface IHasConcurrencyToken
+ {
+ /// <summary>
+ /// Gets the version of this row. Acts as a concurrency token.
+ /// </summary>
+ uint RowVersion { get; }
+
+ /// <summary>
+ /// Called when saving changes to this entity.
+ /// </summary>
+ void OnSavingChanges();
+ }
+}
diff --git a/Jellyfin.Data/IHasPermissions.cs b/Jellyfin.Data/Interfaces/IHasPermissions.cs
index 3be72259a..3be72259a 100644
--- a/Jellyfin.Data/IHasPermissions.cs
+++ b/Jellyfin.Data/Interfaces/IHasPermissions.cs
diff --git a/Jellyfin.Data/Interfaces/IHasReleases.cs b/Jellyfin.Data/Interfaces/IHasReleases.cs
new file mode 100644
index 000000000..3b615893e
--- /dev/null
+++ b/Jellyfin.Data/Interfaces/IHasReleases.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using Jellyfin.Data.Entities.Libraries;
+
+namespace Jellyfin.Data.Interfaces
+{
+ /// <summary>
+ /// An abstraction representing an entity that has releases.
+ /// </summary>
+ public interface IHasReleases
+ {
+ /// <summary>
+ /// Gets a collection containing this entity's releases.
+ /// </summary>
+ ICollection<Release> Releases { get; }
+ }
+}
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs
index 7d864ebc6..08e4db388 100644
--- a/Jellyfin.Server.Implementations/JellyfinDb.cs
+++ b/Jellyfin.Server.Implementations/JellyfinDb.cs
@@ -2,8 +2,8 @@
using System;
using System.Linq;
-using Jellyfin.Data;
using Jellyfin.Data.Entities;
+using Jellyfin.Data.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace Jellyfin.Server.Implementations
@@ -130,7 +130,7 @@ namespace Jellyfin.Server.Implementations
foreach (var saveEntity in ChangeTracker.Entries()
.Where(e => e.State == EntityState.Modified)
.Select(entry => entry.Entity)
- .OfType<ISavingChanges>())
+ .OfType<IHasConcurrencyToken>())
{
saveEntity.OnSavingChanges();
}