aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data/Entities/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Data/Entities/Libraries')
-rw-r--r--Jellyfin.Data/Entities/Libraries/Artwork.cs16
-rw-r--r--Jellyfin.Data/Entities/Libraries/Book.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/BookMetadata.cs23
-rw-r--r--Jellyfin.Data/Entities/Libraries/Chapter.cs23
-rw-r--r--Jellyfin.Data/Entities/Libraries/Collection.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/CollectionItem.cs40
-rw-r--r--Jellyfin.Data/Entities/Libraries/Company.cs17
-rw-r--r--Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs25
-rw-r--r--Jellyfin.Data/Entities/Libraries/CustomItem.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs21
-rw-r--r--Jellyfin.Data/Entities/Libraries/Episode.cs22
-rw-r--r--Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs26
-rw-r--r--Jellyfin.Data/Entities/Libraries/Genre.cs27
-rw-r--r--Jellyfin.Data/Entities/Libraries/ItemMetadata.cs16
-rw-r--r--Jellyfin.Data/Entities/Libraries/Library.cs22
-rw-r--r--Jellyfin.Data/Entities/Libraries/LibraryItem.cs8
-rw-r--r--Jellyfin.Data/Entities/Libraries/MediaFile.cs21
-rw-r--r--Jellyfin.Data/Entities/Libraries/MediaFileStream.cs23
-rw-r--r--Jellyfin.Data/Entities/Libraries/MetadataProvider.cs11
-rw-r--r--Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs23
-rw-r--r--Jellyfin.Data/Entities/Libraries/Movie.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/MovieMetadata.cs25
-rw-r--r--Jellyfin.Data/Entities/Libraries/MusicAlbum.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/MusicAlbumMetadata.cs21
-rw-r--r--Jellyfin.Data/Entities/Libraries/Person.cs13
-rw-r--r--Jellyfin.Data/Entities/Libraries/PersonRole.cs28
-rw-r--r--Jellyfin.Data/Entities/Libraries/Photo.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/PhotoMetadata.cs21
-rw-r--r--Jellyfin.Data/Entities/Libraries/Rating.cs23
-rw-r--r--Jellyfin.Data/Entities/Libraries/RatingSource.cs25
-rw-r--r--Jellyfin.Data/Entities/Libraries/Release.cs16
-rw-r--r--Jellyfin.Data/Entities/Libraries/Season.cs22
-rw-r--r--Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs22
-rw-r--r--Jellyfin.Data/Entities/Libraries/Series.cs3
-rw-r--r--Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs31
-rw-r--r--Jellyfin.Data/Entities/Libraries/Track.cs22
-rw-r--r--Jellyfin.Data/Entities/Libraries/TrackMetadata.cs21
37 files changed, 84 insertions, 591 deletions
diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.cs
index 06cd33330..84a524de2 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.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>
@@ -57,7 +44,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 65535.
/// </remarks>
- [Required]
[MaxLength(65535)]
[StringLength(65535)]
public string Path { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/Book.cs b/Jellyfin.Data/Entities/Libraries/Book.cs
index 2e63f75bd..aea3d58d5 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.cs
index 4a3d290f0..1ff4327b0 100644
--- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
@@ -1,8 +1,6 @@
#pragma warning disable CA2227
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
@@ -17,30 +15,12 @@ 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>
public long? Isbn { get; set; }
@@ -51,7 +31,6 @@ namespace Jellyfin.Data.Entities.Libraries
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 f503de379..11f53ae20 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.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>
@@ -63,7 +45,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name { get; set; }
+ public string? Name { get; set; }
/// <summary>
/// Gets or sets the language.
@@ -72,7 +54,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// Required, Min length = 3, Max length = 3
/// ISO-639-3 3-character language codes.
/// </remarks>
- [Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
diff --git a/Jellyfin.Data/Entities/Libraries/Collection.cs b/Jellyfin.Data/Entities/Libraries/Collection.cs
index 39eded752..4253b7ecc 100644
--- a/Jellyfin.Data/Entities/Libraries/Collection.cs
+++ b/Jellyfin.Data/Entities/Libraries/Collection.cs
@@ -1,3 +1,4 @@
+#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
#pragma warning disable CA2227
using System.Collections.Generic;
@@ -37,7 +38,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name { get; set; }
+ public string? Name { get; set; }
/// <inheritdoc />
[ConcurrencyCheck]
diff --git a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
index f9539964d..e19362bdf 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;
@@ -13,39 +12,10 @@ namespace Jellyfin.Data.Entities.Libraries
/// <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()
+ /// <param name="libraryItem">The library item.</param>
+ public CollectionItem(LibraryItem libraryItem)
{
+ LibraryItem = libraryItem;
}
/// <summary>
@@ -75,7 +45,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// TODO check if this properly updated Dependant and has the proper principal relationship.
/// </remarks>
- public virtual CollectionItem Next { get; set; }
+ public virtual CollectionItem? Next { get; set; }
/// <summary>
/// Gets or sets the previous item in the collection.
@@ -83,7 +53,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// TODO check if this properly updated Dependant and has the proper principal relationship.
/// </remarks>
- public virtual CollectionItem Previous { get; set; }
+ public virtual CollectionItem? Previous { get; set; }
/// <inheritdoc />
public void OnSavingChanges()
diff --git a/Jellyfin.Data/Entities/Libraries/Company.cs b/Jellyfin.Data/Entities/Libraries/Company.cs
index 3b6ed3309..09050bb52 100644
--- a/Jellyfin.Data/Entities/Libraries/Company.cs
+++ b/Jellyfin.Data/Entities/Libraries/Company.cs
@@ -15,22 +15,10 @@ 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()
- {
+ ChildCompanies = new HashSet<Company>();
}
/// <summary>
@@ -57,7 +45,6 @@ namespace Jellyfin.Data.Entities.Libraries
public virtual ICollection<Company> ChildCompanies { get; protected set; }
/// <inheritdoc />
- [NotMapped]
public ICollection<Company> Companies => ChildCompanies;
/// <inheritdoc />
diff --git a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
index 8aa0486af..a29f08c7f 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)
{
}
@@ -39,7 +24,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Description { get; set; }
+ public string? Description { get; set; }
/// <summary>
/// Gets or sets the headquarters.
@@ -49,7 +34,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string Headquarters { get; set; }
+ public string? Headquarters { get; set; }
/// <summary>
/// Gets or sets the country code.
@@ -59,7 +44,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country { get; set; }
+ public string? Country { get; set; }
/// <summary>
/// Gets or sets the homepage.
@@ -69,6 +54,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Homepage { get; set; }
+ public string? Homepage { get; set; }
}
}
diff --git a/Jellyfin.Data/Entities/Libraries/CustomItem.cs b/Jellyfin.Data/Entities/Libraries/CustomItem.cs
index 115489c78..88d1a0c25 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.cs
index f0daedfbe..af2393870 100644
--- a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.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="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.cs
index 0bdc2d764..458c7d9f5 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,31 +13,14 @@ 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>
public int? EpisodeNumber { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
index 7efb840f0..b0ef11e0f 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)
{
}
@@ -42,7 +24,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline { get; set; }
+ public string? Outline { get; set; }
/// <summary>
/// Gets or sets the plot.
@@ -52,7 +34,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot { get; set; }
+ public string? Plot { get; set; }
/// <summary>
/// Gets or sets the tagline.
@@ -62,6 +44,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline { get; set; }
+ public string? Tagline { get; set; }
}
}
diff --git a/Jellyfin.Data/Entities/Libraries/Genre.cs b/Jellyfin.Data/Entities/Libraries/Genre.cs
index 2a2dbd1a5..9f3d65028 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>
@@ -57,7 +33,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Indexed, Required, Max length = 255.
/// </remarks>
- [Required]
[MaxLength(255)]
[StringLength(255)]
public string Name { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs
index d74330c05..d12e011a8 100644
--- a/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs
@@ -43,16 +43,6 @@ namespace Jellyfin.Data.Entities.Libraries
}
/// <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>
/// <remarks>
@@ -67,7 +57,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 1024.
/// </remarks>
- [Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Title { get; set; }
@@ -80,7 +69,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string OriginalTitle { get; set; }
+ public string? OriginalTitle { get; set; }
/// <summary>
/// Gets or sets the sort title.
@@ -90,7 +79,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string SortTitle { get; set; }
+ public string? SortTitle { get; set; }
/// <summary>
/// Gets or sets the language.
@@ -99,7 +88,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// Required, Min length = 3, Max length = 3.
/// ISO-639-3 3-character language codes.
/// </remarks>
- [Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
diff --git a/Jellyfin.Data/Entities/Libraries/Library.cs b/Jellyfin.Data/Entities/Libraries/Library.cs
index 4f82a2e2a..e45384902 100644
--- a/Jellyfin.Data/Entities/Libraries/Library.cs
+++ b/Jellyfin.Data/Entities/Libraries/Library.cs
@@ -1,4 +1,3 @@
-using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
@@ -14,24 +13,11 @@ namespace Jellyfin.Data.Entities.Libraries
/// Initializes a new instance of the <see cref="Library"/> class.
/// </summary>
/// <param name="name">The name of the library.</param>
- public Library(string name)
+ /// <param name="path">The path of the library.</param>
+ public Library(string name, string path)
{
- if (string.IsNullOrWhiteSpace(name))
- {
- throw new ArgumentNullException(nameof(name));
- }
-
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()
- {
+ Path = path;
}
/// <summary>
@@ -49,7 +35,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 128.
/// </remarks>
- [Required]
[MaxLength(128)]
[StringLength(128)]
public string Name { get; set; }
@@ -60,7 +45,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required.
/// </remarks>
- [Required]
public string Path { get; set; }
/// <inheritdoc />
diff --git a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
index a9167aa7f..67ffad944 100644
--- a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
@@ -21,13 +21,6 @@ namespace Jellyfin.Data.Entities.Libraries
}
/// <summary>
- /// Initializes a new instance of the <see cref="LibraryItem"/> class.
- /// </summary>
- protected LibraryItem()
- {
- }
-
- /// <summary>
/// Gets or sets the id.
/// </summary>
/// <remarks>
@@ -51,7 +44,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required.
/// </remarks>
- [Required]
public virtual Library Library { get; set; }
/// <inheritdoc />
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.cs
index 9924d5728..f3e2fe653 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,27 +29,10 @@ 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>
/// <remarks>
@@ -65,7 +47,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 65535.
/// </remarks>
- [Required]
[MaxLength(65535)]
[StringLength(65535)]
public string Path { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
index 5b03e260e..ba21294fc 100644
--- a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
+++ b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
@@ -1,4 +1,5 @@
-using System;
+#pragma warning disable CA1711 // Identifiers should not have incorrect suffix
+
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
@@ -14,27 +15,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.cs
index a18a612bc..fb2587882 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
@@ -25,16 +25,6 @@ namespace Jellyfin.Data.Entities.Libraries
}
/// <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>
/// <remarks>
@@ -49,7 +39,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 1024.
/// </remarks>
- [Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Name { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
index fcfb35bfa..2a9c904c8 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
@@ -14,8 +14,8 @@ 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)
+ /// <param name="metadataProvider">The metadata provider.</param>
+ public MetadataProviderId(string providerId, MetadataProvider metadataProvider)
{
if (string.IsNullOrEmpty(providerId))
{
@@ -23,23 +23,7 @@ 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()
- {
+ MetadataProvider = metadataProvider;
}
/// <summary>
@@ -57,7 +41,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 255.
/// </remarks>
- [Required]
[MaxLength(255)]
[StringLength(255)]
public string ProviderId { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/Movie.cs b/Jellyfin.Data/Entities/Libraries/Movie.cs
index 08db904fa..f89cacff4 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.cs
index aa1501a5c..fb181dea6 100644
--- a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
@@ -17,22 +16,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>
@@ -43,7 +29,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline { get; set; }
+ public string? Outline { get; set; }
/// <summary>
/// Gets or sets the tagline.
@@ -53,7 +39,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline { get; set; }
+ public string? Tagline { get; set; }
/// <summary>
/// Gets or sets the plot.
@@ -63,7 +49,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot { get; set; }
+ public string? Plot { get; set; }
/// <summary>
/// Gets or sets the country code.
@@ -73,7 +59,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country { get; set; }
+ public string? Country { get; set; }
/// <summary>
/// Gets or sets the studios that produced this movie.
@@ -81,7 +67,6 @@ namespace Jellyfin.Data.Entities.Libraries
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 06aff6f45..4049cdac8 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.cs
index 05c0b0374..3080bd692 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>
@@ -41,7 +28,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string Barcode { get; set; }
+ public string? Barcode { get; set; }
/// <summary>
/// Gets or sets the label number.
@@ -51,7 +38,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(255)]
[StringLength(255)]
- public string LabelNumber { get; set; }
+ public string? LabelNumber { get; set; }
/// <summary>
/// Gets or sets the country code.
@@ -61,7 +48,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country { get; set; }
+ public string? Country { get; set; }
/// <summary>
/// Gets or sets a collection containing the labels.
diff --git a/Jellyfin.Data/Entities/Libraries/Person.cs b/Jellyfin.Data/Entities/Libraries/Person.cs
index af4c87b73..159bd47be 100644
--- a/Jellyfin.Data/Entities/Libraries/Person.cs
+++ b/Jellyfin.Data/Entities/Libraries/Person.cs
@@ -32,16 +32,6 @@ namespace Jellyfin.Data.Entities.Libraries
}
/// <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>
/// <remarks>
@@ -56,7 +46,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 1024.
/// </remarks>
- [Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Name { get; set; }
@@ -69,7 +58,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(256)]
[StringLength(256)]
- public string SourceId { get; set; }
+ public string? SourceId { get; set; }
/// <summary>
/// Gets or sets the date added.
diff --git a/Jellyfin.Data/Entities/Libraries/PersonRole.cs b/Jellyfin.Data/Entities/Libraries/PersonRole.cs
index cd38ee83d..988aa84ba 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,32 +17,16 @@ 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)
+ /// <param name="person">The person.</param>
+ public PersonRole(PersonRoleType type, Person person)
{
Type = type;
-
- if (itemMetadata == null)
- {
- throw new ArgumentNullException(nameof(itemMetadata));
- }
-
- itemMetadata.PersonRoles.Add(this);
-
+ Person = person;
+ Artwork = new HashSet<Artwork>();
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>
/// <remarks>
@@ -60,7 +43,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Role { get; set; }
+ public string? Role { get; set; }
/// <summary>
/// Gets or sets the person's role type.
@@ -80,7 +63,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required.
/// </remarks>
- [Required]
public virtual Person Person { get; set; }
/// <inheritdoc />
diff --git a/Jellyfin.Data/Entities/Libraries/Photo.cs b/Jellyfin.Data/Entities/Libraries/Photo.cs
index 25562ec96..eb5c96267 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.cs
index ffc790b57..6c284307d 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.cs
index 98226cd80..6862012a8 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>
@@ -67,7 +48,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// Gets or sets the rating type.
/// If this is <c>null</c> it's the internal user rating.
/// </summary>
- public virtual RatingSource RatingType { get; set; }
+ public virtual RatingSource? RatingType { get; set; }
/// <inheritdoc />
public void OnSavingChanges()
diff --git a/Jellyfin.Data/Entities/Libraries/RatingSource.cs b/Jellyfin.Data/Entities/Libraries/RatingSource.cs
index 549f41804..ae0d806ff 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>
@@ -56,7 +37,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Name { get; set; }
+ public string? Name { get; set; }
/// <summary>
/// Gets or sets the minimum value.
@@ -81,7 +62,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// <summary>
/// Gets or sets the metadata source.
/// </summary>
- public virtual MetadataProviderId Source { get; set; }
+ public virtual MetadataProviderId? Source { get; set; }
/// <inheritdoc />
public void OnSavingChanges()
diff --git a/Jellyfin.Data/Entities/Libraries/Release.cs b/Jellyfin.Data/Entities/Libraries/Release.cs
index b633e08fb..21d403979 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,23 +26,11 @@ 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>
/// <remarks>
@@ -58,7 +45,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// <remarks>
/// Required, Max length = 1024.
/// </remarks>
- [Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Name { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/Season.cs b/Jellyfin.Data/Entities/Libraries/Season.cs
index eb6674dbc..04f723a1d 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,31 +12,14 @@ 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>
public int? SeasonNumber { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs b/Jellyfin.Data/Entities/Libraries/SeasonMetadata.cs
index 7ce79756b..da40a075f 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)
{
}
@@ -42,6 +24,6 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline { get; set; }
+ public string? Outline { get; set; }
}
}
diff --git a/Jellyfin.Data/Entities/Libraries/Series.cs b/Jellyfin.Data/Entities/Libraries/Series.cs
index 8c8317d14..59508831e 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.cs
index 877dbfc69..cc04d033a 100644
--- a/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/SeriesMetadata.cs
@@ -1,9 +1,7 @@
#pragma warning disable CA2227
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
@@ -18,30 +16,12 @@ 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>
/// <remarks>
@@ -49,7 +29,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline { get; set; }
+ public string? Outline { get; set; }
/// <summary>
/// Gets or sets the plot.
@@ -59,7 +39,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot { get; set; }
+ public string? Plot { get; set; }
/// <summary>
/// Gets or sets the tagline.
@@ -69,7 +49,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline { get; set; }
+ public string? Tagline { get; set; }
/// <summary>
/// Gets or sets the country code.
@@ -79,7 +59,7 @@ namespace Jellyfin.Data.Entities.Libraries
/// </remarks>
[MaxLength(2)]
[StringLength(2)]
- public string Country { get; set; }
+ public string? Country { get; set; }
/// <summary>
/// Gets or sets a collection containing the networks.
@@ -87,7 +67,6 @@ namespace Jellyfin.Data.Entities.Libraries
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 782bfb5ce..86a3edff8 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,31 +13,14 @@ 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>
public int? TrackNumber { get; set; }
diff --git a/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs b/Jellyfin.Data/Entities/Libraries/TrackMetadata.cs
index 321f93bf2..042d2b90d 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)
{
}
}