mirror of
https://github.com/jellyfin/jellyfin
synced 2024-10-14 19:54:01 +00:00
Remove constructor side effects and remove unneeded parameterless constructors
This commit is contained in:
parent
b5e3c02865
commit
287dab4655
|
@ -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.Entities
|
|||
EndHour = 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>
|
||||
|
|
|
@ -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.Entities
|
|||
Type = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -36,13 +36,6 @@ namespace Jellyfin.Data.Entities
|
|||
HomeSections = new HashSet<HomeSection>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DisplayPreferences"/> class.
|
||||
/// </summary>
|
||||
protected DisplayPreferences()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Id.
|
||||
/// </summary>
|
||||
|
|
|
@ -32,16 +32,6 @@ namespace Jellyfin.Data.Entities
|
|||
Preferences = 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>
|
||||
|
|
|
@ -19,16 +19,6 @@ namespace Jellyfin.Data.Entities
|
|||
LastModified = 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>
|
||||
|
|
|
@ -28,13 +28,6 @@ namespace Jellyfin.Data.Entities
|
|||
RememberIndexing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemDisplayPreferences"/> class.
|
||||
/// </summary>
|
||||
protected ItemDisplayPreferences()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Id.
|
||||
/// </summary>
|
||||
|
|
|
@ -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.Libraries
|
|||
|
||||
Path = 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>
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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.Libraries
|
|||
|
||||
Language = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -42,16 +42,6 @@ namespace Jellyfin.Data.Entities.Libraries
|
|||
Sources = 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>
|
||||
|
|
|
@ -24,16 +24,6 @@ namespace Jellyfin.Data.Entities.Libraries
|
|||
Name = 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>
|
||||
|
|
|
@ -20,13 +20,6 @@ namespace Jellyfin.Data.Entities.Libraries
|
|||
Library = library;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryItem"/> class.
|
||||
/// </summary>
|
||||
protected LibraryItem()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
|
|
|
@ -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.Libraries
|
|||
Path = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -24,16 +24,6 @@ namespace Jellyfin.Data.Entities.Libraries
|
|||
Name = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -31,16 +31,6 @@ namespace Jellyfin.Data.Entities.Libraries
|
|||
Sources = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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.Libraries
|
|||
|
||||
Name = 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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,6 @@ namespace Jellyfin.Data.Entities
|
|||
Value = 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>
|
||||
|
|
|
@ -23,14 +23,6 @@ namespace Jellyfin.Data.Entities
|
|||
Value = 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>
|
||||
|
|
|
@ -77,14 +77,6 @@ namespace Jellyfin.Data.Entities
|
|||
AddDefaultPreferences();
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
|
Loading…
Reference in a new issue