The Free Software Media System - Server Backend & API
Remove constructor side effects and remove unneeded parameterless constructors
Patrick Barron287dab465517
diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.csindex 7d1b76a3f8..72bca061da 100644--- a/Jellyfin.Data/Entities/AccessSchedule.cs+++ b/Jellyfin.Data/Entities/AccessSchedule.cs@@ -1,7 +1,6 @@using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;-using System.Text.Json.Serialization;using System.Xml.Serialization;using Jellyfin.Data.Enums;@@ -27,14 +26,6 @@ namespace Jellyfin.Data.EntitiesEndHour = endHour;}- /// <summary>- /// Initializes a new instance of the <see cref="AccessSchedule"/> class.- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </summary>- protected AccessSchedule()- {- }-/// <summary>/// Gets or sets the id of this instance./// </summary>diff --git a/Jellyfin.Data/Entities/ActivityLog.cs b/Jellyfin.Data/Entities/ActivityLog.csindex e2d5c71879..80e32db30e 100644--- a/Jellyfin.Data/Entities/ActivityLog.cs+++ b/Jellyfin.Data/Entities/ActivityLog.cs@@ -18,8 +18,7 @@ namespace Jellyfin.Data.Entities/// <param name="name">The name.</param>/// <param name="type">The type.</param>/// <param name="userId">The user id.</param>- /// <param name="logLevel">The log level.</param>- public ActivityLog(string name, string type, Guid userId, LogLevel logLevel = LogLevel.Information)+ public ActivityLog(string name, string type, Guid userId){if (string.IsNullOrEmpty(name)){@@ -35,15 +34,7 @@ namespace Jellyfin.Data.EntitiesType = type;UserId = userId;DateCreated = DateTime.UtcNow;- LogSeverity = logLevel;- }-- /// <summary>- /// Initializes a new instance of the <see cref="ActivityLog"/> class.- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </summary>- protected ActivityLog()- {+ LogSeverity = LogLevel.Information;}/// <summary>diff --git a/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs b/Jellyfin.Data/Entities/CustomItemDisplayPreferences.csindex 511e3b281a..d407180d46 100644--- a/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs+++ b/Jellyfin.Data/Entities/CustomItemDisplayPreferences.cs@@ -15,22 +15,15 @@ namespace Jellyfin.Data.Entities/// <param name="userId">The user id.</param>/// <param name="itemId">The item id.</param>/// <param name="client">The client.</param>- /// <param name="preferenceKey">The preference key.</param>- /// <param name="preferenceValue">The preference value.</param>- public CustomItemDisplayPreferences(Guid userId, Guid itemId, string client, string preferenceKey, string preferenceValue)+ /// <param name="key">The preference key.</param>+ /// <param name="value">The preference value.</param>+ public CustomItemDisplayPreferences(Guid userId, Guid itemId, string client, string key, string value){UserId = userId;ItemId = itemId;Client = client;- Key = preferenceKey;- Value = preferenceValue;- }-- /// <summary>- /// Initializes a new instance of the <see cref="CustomItemDisplayPreferences"/> class.- /// </summary>- protected CustomItemDisplayPreferences()- {+ Key = key;+ Value = value;}/// <summary>diff --git a/Jellyfin.Data/Entities/DisplayPreferences.cs b/Jellyfin.Data/Entities/DisplayPreferences.csindex 1a8ca1da37..d186deb293 100644--- a/Jellyfin.Data/Entities/DisplayPreferences.cs+++ b/Jellyfin.Data/Entities/DisplayPreferences.cs@@ -36,13 +36,6 @@ namespace Jellyfin.Data.EntitiesHomeSections = new HashSet<HomeSection>();}- /// <summary>- /// Initializes a new instance of the <see cref="DisplayPreferences"/> class.- /// </summary>- protected DisplayPreferences()- {- }-/// <summary>/// Gets or sets the Id./// </summary>diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.csindex 878811e59c..8c45dde928 100644--- a/Jellyfin.Data/Entities/Group.cs+++ b/Jellyfin.Data/Entities/Group.cs@@ -32,16 +32,6 @@ namespace Jellyfin.Data.EntitiesPreferences = new HashSet<Preference>();}- /// <summary>- /// Initializes a new instance of the <see cref="Group"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Group()- {- }-/// <summary>/// Gets or sets the id of this group./// </summary>diff --git a/Jellyfin.Data/Entities/ImageInfo.cs b/Jellyfin.Data/Entities/ImageInfo.csindex ab8452e62c..f9ae1a955f 100644--- a/Jellyfin.Data/Entities/ImageInfo.cs+++ b/Jellyfin.Data/Entities/ImageInfo.cs@@ -19,16 +19,6 @@ namespace Jellyfin.Data.EntitiesLastModified = DateTime.UtcNow;}- /// <summary>- /// Initializes a new instance of the <see cref="ImageInfo"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected ImageInfo()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/ItemDisplayPreferences.cs b/Jellyfin.Data/Entities/ItemDisplayPreferences.csindex 2b25bb25f2..f0a04f8ea6 100644--- a/Jellyfin.Data/Entities/ItemDisplayPreferences.cs+++ b/Jellyfin.Data/Entities/ItemDisplayPreferences.cs@@ -28,13 +28,6 @@ namespace Jellyfin.Data.EntitiesRememberIndexing = false;}- /// <summary>- /// Initializes a new instance of the <see cref="ItemDisplayPreferences"/> class.- /// </summary>- protected ItemDisplayPreferences()- {- }-/// <summary>/// Gets or sets the Id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.csindex 06cd333301..df28ce7374 100644--- a/Jellyfin.Data/Entities/Libraries/Artwork.cs+++ b/Jellyfin.Data/Entities/Libraries/Artwork.cs@@ -18,8 +18,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <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)+ public Artwork(string path, ArtKind kind){if (string.IsNullOrEmpty(path)){@@ -28,18 +27,6 @@ namespace Jellyfin.Data.Entities.LibrariesPath = path;Kind = kind;-- owner?.Artwork.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="Artwork"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Artwork()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/Book.cs b/Jellyfin.Data/Entities/Libraries/Book.csindex 2e63f75bd9..aea3d58d58 100644--- a/Jellyfin.Data/Entities/Libraries/Book.cs+++ b/Jellyfin.Data/Entities/Libraries/Book.cs@@ -13,7 +13,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Book"/> class./// </summary>- public Book()+ /// <param name="library">The library.</param>+ public Book(Library library) : base(library){BookMetadata = new HashSet<BookMetadata>();Releases = new HashSet<Release>();diff --git a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs b/Jellyfin.Data/Entities/Libraries/BookMetadata.csindex 4a3d290f01..8b0c965306 100644--- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -17,29 +16,11 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="book">The book.</param>- public BookMetadata(string title, string language, Book book) : base(title, language)+ public BookMetadata(string title, string language) : base(title, language){- if (book == null)- {- throw new ArgumentNullException(nameof(book));- }-- book.BookMetadata.Add(this);-Publishers = new HashSet<Company>();}- /// <summary>- /// Initializes a new instance of the <see cref="BookMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected BookMetadata()- {- }-/// <summary>/// Gets or sets the ISBN./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Chapter.cs b/Jellyfin.Data/Entities/Libraries/Chapter.csindex f503de3794..f253143d74 100644--- a/Jellyfin.Data/Entities/Libraries/Chapter.cs+++ b/Jellyfin.Data/Entities/Libraries/Chapter.cs@@ -17,8 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <param name="language">ISO-639-3 3-character language codes.</param>/// <param name="startTime">The start time for this chapter.</param>- /// <param name="release">The release.</param>- public Chapter(string language, long startTime, Release release)+ public Chapter(string language, long startTime){if (string.IsNullOrEmpty(language)){@@ -27,23 +26,6 @@ namespace Jellyfin.Data.Entities.LibrariesLanguage = language;StartTime = startTime;-- if (release == null)- {- throw new ArgumentNullException(nameof(release));- }-- release.Chapters.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="Chapter"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Chapter()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs b/Jellyfin.Data/Entities/Libraries/CollectionItem.csindex f9539964d0..1157de442b 100644--- a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs+++ b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -10,44 +9,6 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>public class CollectionItem : IHasConcurrencyToken{- /// <summary>- /// Initializes a new instance of the <see cref="CollectionItem"/> class.- /// </summary>- /// <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)- {- if (collection == null)- {- throw new ArgumentNullException(nameof(collection));- }-- collection.Items.Add(this);-- if (next != null)- {- Next = next;- next.Previous = this;- }-- if (previous != null)- {- Previous = previous;- previous.Next = this;- }- }-- /// <summary>- /// Initializes a new instance of the <see cref="CollectionItem"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected CollectionItem()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Company.cs b/Jellyfin.Data/Entities/Libraries/Company.csindex 3b6ed3309a..499ba3800a 100644--- a/Jellyfin.Data/Entities/Libraries/Company.cs+++ b/Jellyfin.Data/Entities/Libraries/Company.cs@@ -15,24 +15,11 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Company"/> class./// </summary>- /// <param name="owner">The owner of this company.</param>- public Company(IHasCompanies owner)+ public Company(){- owner?.Companies.Add(this);-CompanyMetadata = new HashSet<CompanyMetadata>();}- /// <summary>- /// Initializes a new instance of the <see cref="Company"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Company()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.csindex 8aa0486afa..86642b38a5 100644--- a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;namespace Jellyfin.Data.Entities.Libraries@@ -13,21 +12,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="company">The company.</param>- public CompanyMetadata(string title, string language, Company company) : base(title, language)- {- if (company == null)- {- throw new ArgumentNullException(nameof(company));- }-- company.CompanyMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="CompanyMetadata"/> class.- /// </summary>- protected CompanyMetadata()+ public CompanyMetadata(string title, string language) : base(title, language){}diff --git a/Jellyfin.Data/Entities/Libraries/CustomItem.cs b/Jellyfin.Data/Entities/Libraries/CustomItem.csindex 115489c786..88d1a0c258 100644--- a/Jellyfin.Data/Entities/Libraries/CustomItem.cs+++ b/Jellyfin.Data/Entities/Libraries/CustomItem.cs@@ -13,7 +13,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="CustomItem"/> class./// </summary>- public CustomItem()+ /// <param name="library">The library.</param>+ public CustomItem(Library library) : base(library){CustomItemMetadata = new HashSet<CustomItemMetadata>();Releases = new HashSet<Release>();diff --git a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.csindex f0daedfbe8..a69a8eafa4 100644--- a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs@@ -12,24 +12,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="item">The item.</param>- public CustomItemMetadata(string title, string language, CustomItem item) : base(title, language)- {- if (item == null)- {- throw new ArgumentNullException(nameof(item));- }-- item.CustomItemMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="CustomItemMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected CustomItemMetadata()+ public CustomItemMetadata(string title, string language) : base(title, language){}}diff --git a/Jellyfin.Data/Entities/Libraries/Episode.cs b/Jellyfin.Data/Entities/Libraries/Episode.csindex 0bdc2d7642..458c7d9f5a 100644--- a/Jellyfin.Data/Entities/Libraries/Episode.cs+++ b/Jellyfin.Data/Entities/Libraries/Episode.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;using Jellyfin.Data.Interfaces;@@ -14,30 +13,13 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Episode"/> class./// </summary>- /// <param name="season">The season.</param>- public Episode(Season season)+ /// <param name="library">The library.</param>+ public Episode(Library library) : base(library){- if (season == null)- {- throw new ArgumentNullException(nameof(season));- }-- season.Episodes.Add(this);-Releases = new HashSet<Release>();EpisodeMetadata = new HashSet<EpisodeMetadata>();}- /// <summary>- /// Initializes a new instance of the <see cref="Episode"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Episode()- {- }-/// <summary>/// Gets or sets the episode number./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.csindex 7efb840f0b..5662decdb8 100644--- a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;namespace Jellyfin.Data.Entities.Libraries@@ -13,24 +12,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="episode">The episode.</param>- public EpisodeMetadata(string title, string language, Episode episode) : base(title, language)- {- if (episode == null)- {- throw new ArgumentNullException(nameof(episode));- }-- episode.EpisodeMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="EpisodeMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected EpisodeMetadata()+ public EpisodeMetadata(string title, string language) : base(title, language){}diff --git a/Jellyfin.Data/Entities/Libraries/Genre.cs b/Jellyfin.Data/Entities/Libraries/Genre.csindex 2a2dbd1a5d..befa75550a 100644--- a/Jellyfin.Data/Entities/Libraries/Genre.cs+++ b/Jellyfin.Data/Entities/Libraries/Genre.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -14,32 +13,9 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="Genre"/> class./// </summary>/// <param name="name">The name.</param>- /// <param name="itemMetadata">The metadata.</param>- public Genre(string name, ItemMetadata itemMetadata)+ public Genre(string name){- if (string.IsNullOrEmpty(name))- {- throw new ArgumentNullException(nameof(name));- }-Name = name;-- if (itemMetadata == null)- {- throw new ArgumentNullException(nameof(itemMetadata));- }-- itemMetadata.Genres.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="Genre"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Genre()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/ItemMetadata.csindex d74330c051..a0efa66e46 100644--- a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs@@ -42,16 +42,6 @@ namespace Jellyfin.Data.Entities.LibrariesSources = new HashSet<MetadataProviderId>();}- /// <summary>- /// Initializes a new instance of the <see cref="ItemMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to being abstract.- /// </remarks>- protected ItemMetadata()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Library.cs b/Jellyfin.Data/Entities/Libraries/Library.csindex 4f82a2e2a7..3ec4341a48 100644--- a/Jellyfin.Data/Entities/Libraries/Library.cs+++ b/Jellyfin.Data/Entities/Libraries/Library.cs@@ -24,16 +24,6 @@ namespace Jellyfin.Data.Entities.LibrariesName = name;}- /// <summary>- /// Initializes a new instance of the <see cref="Library"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Library()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs b/Jellyfin.Data/Entities/Libraries/LibraryItem.csindex a9167aa7fd..504b9c853b 100644--- a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs+++ b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs@@ -20,13 +20,6 @@ namespace Jellyfin.Data.Entities.LibrariesLibrary = library;}- /// <summary>- /// Initializes a new instance of the <see cref="LibraryItem"/> class.- /// </summary>- protected LibraryItem()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.csindex 9924d5728d..7f64978e24 100644--- a/Jellyfin.Data/Entities/Libraries/MediaFile.cs+++ b/Jellyfin.Data/Entities/Libraries/MediaFile.cs@@ -19,8 +19,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <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)+ public MediaFile(string path, MediaFileKind kind){if (string.IsNullOrEmpty(path)){@@ -30,26 +29,9 @@ namespace Jellyfin.Data.Entities.LibrariesPath = path;Kind = kind;- if (release == null)- {- throw new ArgumentNullException(nameof(release));- }-- release.MediaFiles.Add(this);-MediaFileStreams = new HashSet<MediaFileStream>();}- /// <summary>- /// Initializes a new instance of the <see cref="MediaFile"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MediaFile()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs b/Jellyfin.Data/Entities/Libraries/MediaFileStream.csindex 5b03e260e2..c4468766f9 100644--- a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs+++ b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -14,27 +13,9 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="MediaFileStream"/> class./// </summary>/// <param name="streamNumber">The number of this stream.</param>- /// <param name="mediaFile">The media file.</param>- public MediaFileStream(int streamNumber, MediaFile mediaFile)+ public MediaFileStream(int streamNumber){StreamNumber = streamNumber;-- if (mediaFile == null)- {- throw new ArgumentNullException(nameof(mediaFile));- }-- mediaFile.MediaFileStreams.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="MediaFileStream"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MediaFileStream()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.csindex a18a612bcd..20de5bf4bb 100644--- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs+++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs@@ -24,16 +24,6 @@ namespace Jellyfin.Data.Entities.LibrariesName = name;}- /// <summary>- /// Initializes a new instance of the <see cref="MetadataProvider"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MetadataProvider()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.csindex fcfb35bfac..12672dd25b 100644--- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs+++ b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs@@ -14,8 +14,7 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="MetadataProviderId"/> class./// </summary>/// <param name="providerId">The provider id.</param>- /// <param name="itemMetadata">The metadata entity.</param>- public MetadataProviderId(string providerId, ItemMetadata itemMetadata)+ public MetadataProviderId(string providerId){if (string.IsNullOrEmpty(providerId)){@@ -23,23 +22,6 @@ namespace Jellyfin.Data.Entities.Libraries}ProviderId = providerId;-- if (itemMetadata == null)- {- throw new ArgumentNullException(nameof(itemMetadata));- }-- itemMetadata.Sources.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="MetadataProviderId"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MetadataProviderId()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/Movie.cs b/Jellyfin.Data/Entities/Libraries/Movie.csindex 08db904fa8..f89cacff44 100644--- a/Jellyfin.Data/Entities/Libraries/Movie.cs+++ b/Jellyfin.Data/Entities/Libraries/Movie.cs@@ -13,7 +13,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Movie"/> class./// </summary>- public Movie()+ /// <param name="library">The library.</param>+ public Movie(Library library) : base(library){Releases = new HashSet<Release>();MovieMetadata = new HashSet<MovieMetadata>();diff --git a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs b/Jellyfin.Data/Entities/Libraries/MovieMetadata.csindex aa1501a5cc..8cf7ca6a7f 100644--- a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs@@ -17,22 +17,9 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <param name="title">The title or name of the movie.</param>/// <param name="language">ISO-639-3 3-character language codes.</param>- /// <param name="movie">The movie.</param>- public MovieMetadata(string title, string language, Movie movie) : base(title, language)+ public MovieMetadata(string title, string language) : base(title, language){Studios = new HashSet<Company>();-- movie.MovieMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="MovieMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MovieMetadata()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbum.csindex 06aff6f457..4049cdac8e 100644--- a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs+++ b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs@@ -12,7 +12,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="MusicAlbum"/> class./// </summary>- public MusicAlbum()+ /// <param name="library">The library.</param>+ public MusicAlbum(Library library) : base(library){MusicAlbumMetadata = new HashSet<MusicAlbumMetadata>();Tracks = new HashSet<Track>();diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.csindex 05c0b0374b..9e44e550af 100644--- a/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs@@ -15,22 +15,9 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <param name="title">The title or name of the album.</param>/// <param name="language">ISO-639-3 3-character language codes.</param>- /// <param name="album">The music album.</param>- public MusicAlbumMetadata(string title, string language, MusicAlbum album) : base(title, language)+ public MusicAlbumMetadata(string title, string language) : base(title, language){Labels = new HashSet<Company>();-- album.MusicAlbumMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="MusicAlbumMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected MusicAlbumMetadata()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/Person.cs b/Jellyfin.Data/Entities/Libraries/Person.csindex af4c87b73c..cc4b9e0f9f 100644--- a/Jellyfin.Data/Entities/Libraries/Person.cs+++ b/Jellyfin.Data/Entities/Libraries/Person.cs@@ -31,16 +31,6 @@ namespace Jellyfin.Data.Entities.LibrariesSources = new HashSet<MetadataProviderId>();}- /// <summary>- /// Initializes a new instance of the <see cref="Person"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Person()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/PersonRole.cs b/Jellyfin.Data/Entities/Libraries/PersonRole.csindex cd38ee83d0..3ae2e4a685 100644--- a/Jellyfin.Data/Entities/Libraries/PersonRole.cs+++ b/Jellyfin.Data/Entities/Libraries/PersonRole.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;@@ -18,31 +17,12 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="PersonRole"/> class./// </summary>/// <param name="type">The role type.</param>- /// <param name="itemMetadata">The metadata.</param>- public PersonRole(PersonRoleType type, ItemMetadata itemMetadata)+ public PersonRole(PersonRoleType type){Type = type;-- if (itemMetadata == null)- {- throw new ArgumentNullException(nameof(itemMetadata));- }-- itemMetadata.PersonRoles.Add(this);-Sources = new HashSet<MetadataProviderId>();}- /// <summary>- /// Initializes a new instance of the <see cref="PersonRole"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected PersonRole()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Photo.cs b/Jellyfin.Data/Entities/Libraries/Photo.csindex 25562ec96f..eb5c962675 100644--- a/Jellyfin.Data/Entities/Libraries/Photo.cs+++ b/Jellyfin.Data/Entities/Libraries/Photo.cs@@ -13,7 +13,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Photo"/> class./// </summary>- public Photo()+ /// <param name="library">The library.</param>+ public Photo(Library library) : base(library){PhotoMetadata = new HashSet<PhotoMetadata>();Releases = new HashSet<Release>();diff --git a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs b/Jellyfin.Data/Entities/Libraries/PhotoMetadata.csindex ffc790b574..6c284307d7 100644--- a/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs@@ -1,5 +1,3 @@-using System;-namespace Jellyfin.Data.Entities.Libraries{/// <summary>@@ -12,24 +10,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <param name="title">The title or name of the photo.</param>/// <param name="language">ISO-639-3 3-character language codes.</param>- /// <param name="photo">The photo.</param>- public PhotoMetadata(string title, string language, Photo photo) : base(title, language)- {- if (photo == null)- {- throw new ArgumentNullException(nameof(photo));- }-- photo.PhotoMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="PhotoMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected PhotoMetadata()+ public PhotoMetadata(string title, string language) : base(title, language){}}diff --git a/Jellyfin.Data/Entities/Libraries/Rating.cs b/Jellyfin.Data/Entities/Libraries/Rating.csindex 98226cd802..0ea933fd79 100644--- a/Jellyfin.Data/Entities/Libraries/Rating.cs+++ b/Jellyfin.Data/Entities/Libraries/Rating.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -14,27 +13,9 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="Rating"/> class./// </summary>/// <param name="value">The value.</param>- /// <param name="itemMetadata">The metadata.</param>- public Rating(double value, ItemMetadata itemMetadata)+ public Rating(double value){Value = value;-- if (itemMetadata == null)- {- throw new ArgumentNullException(nameof(itemMetadata));- }-- itemMetadata.Ratings.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="Rating"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Rating()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/RatingSource.cs b/Jellyfin.Data/Entities/Libraries/RatingSource.csindex 549f418042..7e1a5a8f46 100644--- a/Jellyfin.Data/Entities/Libraries/RatingSource.cs+++ b/Jellyfin.Data/Entities/Libraries/RatingSource.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;using Jellyfin.Data.Interfaces;@@ -15,28 +14,10 @@ namespace Jellyfin.Data.Entities.Libraries/// </summary>/// <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)+ public RatingSource(double minimumValue, double maximumValue){MinimumValue = minimumValue;MaximumValue = maximumValue;-- if (rating == null)- {- throw new ArgumentNullException(nameof(rating));- }-- rating.RatingType = this;- }-- /// <summary>- /// Initializes a new instance of the <see cref="RatingSource"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected RatingSource()- {}/// <summary>diff --git a/Jellyfin.Data/Entities/Libraries/Release.cs b/Jellyfin.Data/Entities/Libraries/Release.csindex b633e08fb3..1871e0f10b 100644--- a/Jellyfin.Data/Entities/Libraries/Release.cs+++ b/Jellyfin.Data/Entities/Libraries/Release.cs@@ -17,8 +17,7 @@ namespace Jellyfin.Data.Entities.Libraries/// Initializes a new instance of the <see cref="Release"/> class./// </summary>/// <param name="name">The name of this release.</param>- /// <param name="owner">The owner of this release.</param>- public Release(string name, IHasReleases owner)+ public Release(string name){if (string.IsNullOrEmpty(name)){@@ -27,22 +26,10 @@ namespace Jellyfin.Data.Entities.LibrariesName = name;- owner?.Releases.Add(this);-MediaFiles = new HashSet<MediaFile>();Chapters = new HashSet<Chapter>();}- /// <summary>- /// Initializes a new instance of the <see cref="Release"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Release()- {- }-/// <summary>/// Gets or sets the id./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Season.cs b/Jellyfin.Data/Entities/Libraries/Season.csindex eb6674dbc3..04f723a1d1 100644--- a/Jellyfin.Data/Entities/Libraries/Season.cs+++ b/Jellyfin.Data/Entities/Libraries/Season.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;namespace Jellyfin.Data.Entities.Libraries@@ -13,30 +12,13 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Season"/> class./// </summary>- /// <param name="series">The series.</param>- public Season(Series series)+ /// <param name="library">The library.</param>+ public Season(Library library) : base(library){- if (series == null)- {- throw new ArgumentNullException(nameof(series));- }-- series.Seasons.Add(this);-Episodes = new HashSet<Episode>();SeasonMetadata = new HashSet<SeasonMetadata>();}- /// <summary>- /// Initializes a new instance of the <see cref="Season"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Season()- {- }-/// <summary>/// Gets or sets the season number./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.csindex 7ce79756b2..61714f9095 100644--- a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs@@ -1,4 +1,3 @@-using System;using System.ComponentModel.DataAnnotations;namespace Jellyfin.Data.Entities.Libraries@@ -13,24 +12,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="season">The season.</param>- public SeasonMetadata(string title, string language, Season season) : base(title, language)- {- if (season == null)- {- throw new ArgumentNullException(nameof(season));- }-- season.SeasonMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="SeasonMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected SeasonMetadata()+ public SeasonMetadata(string title, string language) : base(title, language){}diff --git a/Jellyfin.Data/Entities/Libraries/Series.cs b/Jellyfin.Data/Entities/Libraries/Series.csindex 8c8317d14b..59508831e4 100644--- a/Jellyfin.Data/Entities/Libraries/Series.cs+++ b/Jellyfin.Data/Entities/Libraries/Series.cs@@ -13,7 +13,8 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Series"/> class./// </summary>- public Series()+ /// <param name="library">The library.</param>+ public Series(Library library) : base(library){DateAdded = DateTime.UtcNow;Seasons = new HashSet<Season>();diff --git a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.csindex 877dbfc69c..e1acd2d457 100644--- a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations;using System.ComponentModel.DataAnnotations.Schema;@@ -18,29 +17,11 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="series">The series.</param>- public SeriesMetadata(string title, string language, Series series) : base(title, language)+ public SeriesMetadata(string title, string language) : base(title, language){- if (series == null)- {- throw new ArgumentNullException(nameof(series));- }-- series.SeriesMetadata.Add(this);-Networks = new HashSet<Company>();}- /// <summary>- /// Initializes a new instance of the <see cref="SeriesMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected SeriesMetadata()- {- }-/// <summary>/// Gets or sets the outline./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/Track.cs b/Jellyfin.Data/Entities/Libraries/Track.csindex 782bfb5ce7..86a3edff83 100644--- a/Jellyfin.Data/Entities/Libraries/Track.cs+++ b/Jellyfin.Data/Entities/Libraries/Track.cs@@ -1,6 +1,5 @@#pragma warning disable CA2227-using System;using System.Collections.Generic;using Jellyfin.Data.Interfaces;@@ -14,30 +13,13 @@ namespace Jellyfin.Data.Entities.Libraries/// <summary>/// Initializes a new instance of the <see cref="Track"/> class./// </summary>- /// <param name="album">The album.</param>- public Track(MusicAlbum album)+ /// <param name="library">The library.</param>+ public Track(Library library) : base(library){- if (album == null)- {- throw new ArgumentNullException(nameof(album));- }-- album.Tracks.Add(this);-Releases = new HashSet<Release>();TrackMetadata = new HashSet<TrackMetadata>();}- /// <summary>- /// Initializes a new instance of the <see cref="Track"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected Track()- {- }-/// <summary>/// Gets or sets the track number./// </summary>diff --git a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs b/Jellyfin.Data/Entities/Libraries/TrackMetadata.csindex 321f93bf2e..042d2b90db 100644--- a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs+++ b/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs@@ -1,5 +1,3 @@-using System;-namespace Jellyfin.Data.Entities.Libraries{/// <summary>@@ -12,24 +10,7 @@ namespace Jellyfin.Data.Entities.Libraries/// </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="track">The track.</param>- public TrackMetadata(string title, string language, Track track) : base(title, language)- {- if (track == null)- {- throw new ArgumentNullException(nameof(track));- }-- track.TrackMetadata.Add(this);- }-- /// <summary>- /// Initializes a new instance of the <see cref="TrackMetadata"/> class.- /// </summary>- /// <remarks>- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </remarks>- protected TrackMetadata()+ public TrackMetadata(string title, string language) : base(title, language){}}diff --git a/Jellyfin.Data/Entities/Permission.cs b/Jellyfin.Data/Entities/Permission.csindex d92e5d9d25..17e3bf50e1 100644--- a/Jellyfin.Data/Entities/Permission.cs+++ b/Jellyfin.Data/Entities/Permission.cs@@ -22,14 +22,6 @@ namespace Jellyfin.Data.EntitiesValue = value;}- /// <summary>- /// Initializes a new instance of the <see cref="Permission"/> class.- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </summary>- protected Permission()- {- }-/// <summary>/// Gets or sets the id of this permission./// </summary>diff --git a/Jellyfin.Data/Entities/Preference.cs b/Jellyfin.Data/Entities/Preference.csindex 4efddf2a41..40f2f8ede9 100644--- a/Jellyfin.Data/Entities/Preference.cs+++ b/Jellyfin.Data/Entities/Preference.cs@@ -23,14 +23,6 @@ namespace Jellyfin.Data.EntitiesValue = value ?? throw new ArgumentNullException(nameof(value));}- /// <summary>- /// Initializes a new instance of the <see cref="Preference"/> class.- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </summary>- protected Preference()- {- }-/// <summary>/// Gets or sets the id of this preference./// </summary>diff --git a/Jellyfin.Data/Entities/User.cs b/Jellyfin.Data/Entities/User.csindex 362f3b4ebb..28e12adde6 100644--- a/Jellyfin.Data/Entities/User.cs+++ b/Jellyfin.Data/Entities/User.cs@@ -77,14 +77,6 @@ namespace Jellyfin.Data.EntitiesAddDefaultPreferences();}- /// <summary>- /// Initializes a new instance of the <see cref="User"/> class.- /// Default constructor. Protected due to required properties, but present because EF needs it.- /// </summary>- protected User()- {- }-/// <summary>/// Gets or sets the Id of the user./// </summary>