diff --git a/Jellyfin.Data/Entities/ActivityLog.cs b/Jellyfin.Data/Entities/ActivityLog.cs
index ac61b9e3ba..3858916d15 100644
--- a/Jellyfin.Data/Entities/ActivityLog.cs
+++ b/Jellyfin.Data/Entities/ActivityLog.cs
@@ -3,6 +3,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Data.Entities
@@ -10,7 +11,7 @@ namespace Jellyfin.Data.Entities
///
/// An entity referencing an activity log entry.
///
- public partial class ActivityLog : ISavingChanges
+ public partial class ActivityLog : IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
diff --git a/Jellyfin.Data/Entities/Group.cs b/Jellyfin.Data/Entities/Group.cs
index a1ec6b1fa4..ca12ba4213 100644
--- a/Jellyfin.Data/Entities/Group.cs
+++ b/Jellyfin.Data/Entities/Group.cs
@@ -6,13 +6,14 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities
{
///
/// An entity representing a group.
///
- public partial class Group : IHasPermissions, ISavingChanges
+ public partial class Group : IHasPermissions, IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
diff --git a/Jellyfin.Data/Entities/Libraries/Artwork.cs b/Jellyfin.Data/Entities/Libraries/Artwork.cs
index 2a34a8dff1..7be22af254 100644
--- a/Jellyfin.Data/Entities/Libraries/Artwork.cs
+++ b/Jellyfin.Data/Entities/Libraries/Artwork.cs
@@ -1,210 +1,81 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Artwork
+ ///
+ /// An entity representing artwork.
+ ///
+ public class Artwork : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Artwork()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static Artwork CreateArtworkUnsafe()
- {
- return new Artwork();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- ///
- ///
- public Artwork(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
+ /// The path.
+ /// The kind of art.
+ /// The owner.
+ public Artwork(string path, ArtKind kind, IHasArtwork owner)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
- this.Path = path;
+ Path = path;
+ Kind = kind;
- this.Kind = kind;
-
- if (_metadata0 == null)
- {
- throw new ArgumentNullException(nameof(_metadata0));
- }
-
- _metadata0.Artwork.Add(this);
-
- if (_personrole1 == null)
- {
- throw new ArgumentNullException(nameof(_personrole1));
- }
-
- _personrole1.Artwork = this;
-
- Init();
+ owner?.Artwork.Add(this);
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- ///
- ///
- ///
- ///
- public static Artwork Create(string path, Enums.ArtKind kind, Metadata _metadata0, PersonRole _personrole1)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected Artwork()
{
- return new Artwork(path, kind, _metadata0, _personrole1);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ ///
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; protected set; }
///
- /// Backing field for Path.
- ///
- protected string _Path;
- ///
- /// When provided in a partial class, allows value of Path to be changed before setting.
- ///
- partial void SetPath(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Path to be changed before returning.
- ///
- partial void GetPath(ref string result);
-
- ///
- /// Required, Max length = 65535
+ /// Gets or sets the path.
///
+ ///
+ /// Required, Max length = 65535.
+ ///
[Required]
[MaxLength(65535)]
[StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
-
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
+ public string Path { get; set; }
///
- /// Backing field for Kind.
+ /// Gets or sets the kind of artwork.
///
- internal Enums.ArtKind _Kind;
- ///
- /// When provided in a partial class, allows value of Kind to be changed before setting.
- ///
- partial void SetKind(Enums.ArtKind oldValue, ref Enums.ArtKind newValue);
- ///
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- ///
- partial void GetKind(ref Enums.ArtKind result);
+ ///
+ /// Required.
+ ///
+ public ArtKind Kind { get; set; }
- ///
- /// Indexed, Required.
- ///
- [Required]
- public Enums.ArtKind Kind
- {
- get
- {
- Enums.ArtKind value = _Kind;
- GetKind(ref value);
- return _Kind = value;
- }
-
- set
- {
- Enums.ArtKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Book.cs b/Jellyfin.Data/Entities/Libraries/Book.cs
index 1ddc5ce8b1..8337788ddd 100644
--- a/Jellyfin.Data/Entities/Libraries/Book.cs
+++ b/Jellyfin.Data/Entities/Libraries/Book.cs
@@ -1,72 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Book : LibraryItem
+ ///
+ /// An entity representing a book.
+ ///
+ public class Book : LibraryItem, IHasReleases
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Book()
+ public Book()
{
BookMetadata = new HashSet();
Releases = new HashSet();
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets a collection containing the metadata for this book.
///
- public static Book CreateBookUnsafe()
- {
- return new Book();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public Book(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.BookMetadata = new HashSet();
- this.Releases = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public static Book Create(Guid urlid, DateTime dateadded)
- {
- return new Book(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("BookMetadata_BookMetadata_Id")]
public virtual ICollection BookMetadata { get; protected set; }
- [ForeignKey("Release_Releases_Id")]
+ ///
public virtual ICollection Releases { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
index 91eecbbf99..bd716712b1 100644
--- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
@@ -1,125 +1,55 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class BookMetadata : Metadata
+ ///
+ /// An entity containing metadata for a book.
+ ///
+ public class BookMetadata : Metadata, IHasCompanies
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The title or name of the object.
+ /// ISO-639-3 3-character language codes.
+ /// The book.
+ public BookMetadata(string title, string language, Book book) : base(title, language)
+ {
+ if (book == null)
+ {
+ throw new ArgumentNullException(nameof(book));
+ }
+
+ book.BookMetadata.Add(this);
+
+ Publishers = new HashSet();
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected BookMetadata()
{
- Publishers = new HashSet();
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets the ISBN.
///
- public static BookMetadata CreateBookMetadataUnsafe()
- {
- return new BookMetadata();
- }
+ public long? Isbn { get; set; }
///
- /// Public constructor with required data.
+ /// Gets or sets a collection of the publishers for this book.
///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
- {
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_book0 == null)
- {
- throw new ArgumentNullException(nameof(_book0));
- }
-
- _book0.BookMetadata.Add(this);
-
- this.Publishers = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
- {
- return new BookMetadata(title, language, dateadded, datemodified, _book0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for ISBN.
- ///
- protected long? _ISBN;
- ///
- /// When provided in a partial class, allows value of ISBN to be changed before setting.
- ///
- partial void SetISBN(long? oldValue, ref long? newValue);
- ///
- /// When provided in a partial class, allows value of ISBN to be changed before returning.
- ///
- partial void GetISBN(ref long? result);
-
- public long? ISBN
- {
- get
- {
- long? value = _ISBN;
- GetISBN(ref value);
- return _ISBN = value;
- }
-
- set
- {
- long? oldValue = _ISBN;
- SetISBN(oldValue, ref value);
- if (oldValue != value)
- {
- _ISBN = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Company_Publishers_Id")]
public virtual ICollection Publishers { get; protected set; }
+
+ ///
+ [NotMapped]
+ public ICollection Companies => Publishers;
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Chapter.cs b/Jellyfin.Data/Entities/Libraries/Chapter.cs
index 2f36443183..d9293c3cc4 100644
--- a/Jellyfin.Data/Entities/Libraries/Chapter.cs
+++ b/Jellyfin.Data/Entities/Libraries/Chapter.cs
@@ -1,277 +1,102 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Chapter
+ ///
+ /// An entity representing a chapter.
+ ///
+ public class Chapter : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- ///
- protected Chapter()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static Chapter CreateChapterUnsafe()
- {
- return new Chapter();
- }
-
- ///
- /// Public constructor with required data.
+ /// Initializes a new instance of the class.
///
/// ISO-639-3 3-character language codes.
- ///
- ///
- public Chapter(string language, long timestart, Release _release0)
+ /// The start time for this chapter.
+ /// The release.
+ public Chapter(string language, long startTime, Release release)
{
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
}
- this.Language = language;
+ Language = language;
+ StartTime = startTime;
- this.TimeStart = timestart;
-
- if (_release0 == null)
+ if (release == null)
{
- throw new ArgumentNullException(nameof(_release0));
+ throw new ArgumentNullException(nameof(release));
}
- _release0.Chapters.Add(this);
-
-
- Init();
+ release.Chapters.Add(this);
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- /// ISO-639-3 3-character language codes.
- ///
- ///
- public static Chapter Create(string language, long timestart, Release _release0)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected Chapter()
{
- return new Chapter(language, timestart, _release0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Name.
- ///
- protected string _Name;
- ///
- /// When provided in a partial class, allows value of Name to be changed before setting.
- ///
- partial void SetName(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Name to be changed before returning.
- ///
- partial void GetName(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the name.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ public string Name { get; set; }
///
- /// Backing field for Language.
+ /// Gets or sets the language.
///
- protected string _Language;
- ///
- /// When provided in a partial class, allows value of Language to be changed before setting.
- ///
- partial void SetLanguage(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Language to be changed before returning.
- ///
- partial void GetLanguage(ref string result);
-
- ///
+ ///
/// Required, Min length = 3, Max length = 3
/// ISO-639-3 3-character language codes.
- ///
+ ///
[Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
- public string Language
- {
- get
- {
- string value = _Language;
- GetLanguage(ref value);
- return _Language = value;
- }
-
- set
- {
- string oldValue = _Language;
- SetLanguage(oldValue, ref value);
- if (oldValue != value)
- {
- _Language = value;
- }
- }
- }
+ public string Language { get; set; }
///
- /// Backing field for TimeStart.
+ /// Gets or sets the start time.
///
- protected long _TimeStart;
- ///
- /// When provided in a partial class, allows value of TimeStart to be changed before setting.
- ///
- partial void SetTimeStart(long oldValue, ref long newValue);
- ///
- /// When provided in a partial class, allows value of TimeStart to be changed before returning.
- ///
- partial void GetTimeStart(ref long result);
-
- ///
+ ///
/// Required.
- ///
- [Required]
- public long TimeStart
- {
- get
- {
- long value = _TimeStart;
- GetTimeStart(ref value);
- return _TimeStart = value;
- }
-
- set
- {
- long oldValue = _TimeStart;
- SetTimeStart(oldValue, ref value);
- if (oldValue != value)
- {
- _TimeStart = value;
- }
- }
- }
+ ///
+ public long StartTime { get; set; }
///
- /// Backing field for TimeEnd.
+ /// Gets or sets the end time.
///
- protected long? _TimeEnd;
- ///
- /// When provided in a partial class, allows value of TimeEnd to be changed before setting.
- ///
- partial void SetTimeEnd(long? oldValue, ref long? newValue);
- ///
- /// When provided in a partial class, allows value of TimeEnd to be changed before returning.
- ///
- partial void GetTimeEnd(ref long? result);
+ public long? EndTime { get; set; }
- public long? TimeEnd
- {
- get
- {
- long? value = _TimeEnd;
- GetTimeEnd(ref value);
- return _TimeEnd = value;
- }
-
- set
- {
- long? oldValue = _TimeEnd;
- SetTimeEnd(oldValue, ref value);
- if (oldValue != value)
- {
- _TimeEnd = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public uint RowVersion { get; protected set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Collection.cs b/Jellyfin.Data/Entities/Libraries/Collection.cs
index d054d8ff99..2e1bbcfb60 100644
--- a/Jellyfin.Data/Entities/Libraries/Collection.cs
+++ b/Jellyfin.Data/Entities/Libraries/Collection.cs
@@ -1,123 +1,55 @@
-#pragma warning disable CS1591
-
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Collection
+ ///
+ /// An entity representing a collection.
+ ///
+ public class Collection : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor.
+ /// Initializes a new instance of the class.
///
public Collection()
{
- CollectionItem = new LinkedList();
-
- Init();
+ Items = new HashSet();
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Name.
- ///
- protected string _Name;
- ///
- /// When provided in a partial class, allows value of Name to be changed before setting.
- ///
- partial void SetName(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Name to be changed before returning.
- ///
- partial void GetName(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the name.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets a collection containing this collection's items.
+ ///
+ public virtual ICollection Items { get; protected set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CollectionItem_CollectionItem_Id")]
- public virtual ICollection CollectionItem { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
index 4b01d814fb..c9306f630a 100644
--- a/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/CollectionItem.cs
@@ -1,156 +1,94 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CollectionItem
+ ///
+ /// An entity representing a collection item.
+ ///
+ public class CollectionItem : IHasConcurrencyToken
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The collection.
+ /// The previous item.
+ /// The next item.
+ 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;
+ }
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected CollectionItem()
{
- // NOTE: This class has one-to-one associations with CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets the id.
///
- public static CollectionItem CreateCollectionItemUnsafe()
- {
- return new CollectionItem();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- ///
- public CollectionItem(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
- {
- // NOTE: This class has one-to-one associations with CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- if (_collection0 == null)
- {
- throw new ArgumentNullException(nameof(_collection0));
- }
-
- _collection0.CollectionItem.Add(this);
-
- if (_collectionitem1 == null)
- {
- throw new ArgumentNullException(nameof(_collectionitem1));
- }
-
- _collectionitem1.Next = this;
-
- if (_collectionitem2 == null)
- {
- throw new ArgumentNullException(nameof(_collectionitem2));
- }
-
- _collectionitem2.Previous = this;
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- ///
- public static CollectionItem Create(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
- {
- return new CollectionItem(_collection0, _collectionitem1, _collectionitem2);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
+ public int Id { get; set; }
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets the library item.
+ ///
+ ///
+ /// Required.
+ ///
+ public virtual LibraryItem LibraryItem { get; set; }
+
+ ///
+ /// Gets or sets the next item in the collection.
+ ///
+ ///
+ /// TODO check if this properly updated dependant and has the proper principal relationship
+ ///
+ public virtual CollectionItem Next { get; set; }
+
+ ///
+ /// Gets or sets the previous item in the collection.
+ ///
+ ///
+ /// TODO check if this properly updated dependant and has the proper principal relationship
+ ///
+ public virtual CollectionItem Previous { get; set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- ///
- /// Required.
- ///
- [ForeignKey("LibraryItem_Id")]
- public virtual LibraryItem LibraryItem { get; set; }
-
- ///
- /// TODO check if this properly updated dependant and has the proper principal relationship
- ///
- [ForeignKey("CollectionItem_Next_Id")]
- public virtual CollectionItem Next { get; set; }
-
- ///
- /// TODO check if this properly updated dependant and has the proper principal relationship
- ///
- [ForeignKey("CollectionItem_Previous_Id")]
- public virtual CollectionItem Previous { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Company.cs b/Jellyfin.Data/Entities/Libraries/Company.cs
index 10df429cd7..02da26bc22 100644
--- a/Jellyfin.Data/Entities/Libraries/Company.cs
+++ b/Jellyfin.Data/Entities/Libraries/Company.cs
@@ -1,159 +1,67 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Company
+ ///
+ /// An entity representing a company.
+ ///
+ public class Company : IHasCompanies, IHasConcurrencyToken
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The owner of this company.
+ public Company(IHasCompanies owner)
+ {
+ owner?.Companies.Add(this);
+
+ CompanyMetadata = new HashSet();
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected Company()
{
- CompanyMetadata = new HashSet();
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets the id.
///
- public static Company CreateCompanyUnsafe()
- {
- return new Company();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- ///
- ///
- ///
- public Company(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
- {
- if (_moviemetadata0 == null)
- {
- throw new ArgumentNullException(nameof(_moviemetadata0));
- }
-
- _moviemetadata0.Studios.Add(this);
-
- if (_seriesmetadata1 == null)
- {
- throw new ArgumentNullException(nameof(_seriesmetadata1));
- }
-
- _seriesmetadata1.Networks.Add(this);
-
- if (_musicalbummetadata2 == null)
- {
- throw new ArgumentNullException(nameof(_musicalbummetadata2));
- }
-
- _musicalbummetadata2.Labels.Add(this);
-
- if (_bookmetadata3 == null)
- {
- throw new ArgumentNullException(nameof(_bookmetadata3));
- }
-
- _bookmetadata3.Publishers.Add(this);
-
- if (_company4 == null)
- {
- throw new ArgumentNullException(nameof(_company4));
- }
-
- _company4.Parent = this;
-
- this.CompanyMetadata = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- ///
- ///
- ///
- public static Company Create(MovieMetadata _moviemetadata0, SeriesMetadata _seriesmetadata1, MusicAlbumMetadata _musicalbummetadata2, BookMetadata _bookmetadata3, Company _company4)
- {
- return new Company(_moviemetadata0, _seriesmetadata1, _musicalbummetadata2, _bookmetadata3, _company4);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
+ public int Id { get; protected set; }
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets a collection containing the metadata.
+ ///
+ public virtual ICollection CompanyMetadata { get; protected set; }
+
+ ///
+ /// Gets or sets a collection containing this company's child companies.
+ ///
+ public virtual ICollection ChildCompanies { get; protected set; }
+
+ ///
+ [NotMapped]
+ public ICollection Companies => ChildCompanies;
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CompanyMetadata_CompanyMetadata_Id")]
- public virtual ICollection CompanyMetadata { get; protected set; }
- [ForeignKey("Company_Parent_Id")]
- public virtual Company Parent { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
index f81beb0d58..60cc96a340 100644
--- a/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/CompanyMetadata.cs
@@ -1,236 +1,74 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CompanyMetadata : Metadata
+ ///
+ /// An entity holding metadata for a .
+ ///
+ public class CompanyMetadata : Metadata
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The title or name of the object.
+ /// ISO-639-3 3-character language codes.
+ /// The company.
+ public CompanyMetadata(string title, string language, Company company) : base(title, language)
+ {
+ if (company == null)
+ {
+ throw new ArgumentNullException(nameof(company));
+ }
+
+ company.CompanyMetadata.Add(this);
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
protected CompanyMetadata()
{
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static CompanyMetadata CreateCompanyMetadataUnsafe()
- {
- return new CompanyMetadata();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public CompanyMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
- {
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_company0 == null)
- {
- throw new ArgumentNullException(nameof(_company0));
- }
-
- _company0.CompanyMetadata.Add(this);
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public static CompanyMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Company _company0)
- {
- return new CompanyMetadata(title, language, dateadded, datemodified, _company0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Description.
- ///
- protected string _Description;
- ///
- /// When provided in a partial class, allows value of Description to be changed before setting.
- ///
- partial void SetDescription(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Description to be changed before returning.
- ///
- partial void GetDescription(ref string result);
-
- ///
- /// Max length = 65535
+ /// Gets or sets the description.
///
+ ///
+ /// Max length = 65535.
+ ///
[MaxLength(65535)]
[StringLength(65535)]
- public string Description
- {
- get
- {
- string value = _Description;
- GetDescription(ref value);
- return _Description = value;
- }
-
- set
- {
- string oldValue = _Description;
- SetDescription(oldValue, ref value);
- if (oldValue != value)
- {
- _Description = value;
- }
- }
- }
+ public string Description { get; set; }
///
- /// Backing field for Headquarters.
- ///
- protected string _Headquarters;
- ///
- /// When provided in a partial class, allows value of Headquarters to be changed before setting.
- ///
- partial void SetHeadquarters(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Headquarters to be changed before returning.
- ///
- partial void GetHeadquarters(ref string result);
-
- ///
- /// Max length = 255
+ /// Gets or sets the headquarters.
///
+ ///
+ /// Max length = 255.
+ ///
[MaxLength(255)]
[StringLength(255)]
- public string Headquarters
- {
- get
- {
- string value = _Headquarters;
- GetHeadquarters(ref value);
- return _Headquarters = value;
- }
-
- set
- {
- string oldValue = _Headquarters;
- SetHeadquarters(oldValue, ref value);
- if (oldValue != value)
- {
- _Headquarters = value;
- }
- }
- }
+ public string Headquarters { get; set; }
///
- /// Backing field for Country.
- ///
- protected string _Country;
- ///
- /// When provided in a partial class, allows value of Country to be changed before setting.
- ///
- partial void SetCountry(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Country to be changed before returning.
- ///
- partial void GetCountry(ref string result);
-
- ///
- /// Max length = 2
+ /// Gets or sets the country code.
///
+ ///
+ /// Max length = 2.
+ ///
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
-
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
+ public string Country { get; set; }
///
- /// Backing field for Homepage.
- ///
- protected string _Homepage;
- ///
- /// When provided in a partial class, allows value of Homepage to be changed before setting.
- ///
- partial void SetHomepage(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Homepage to be changed before returning.
- ///
- partial void GetHomepage(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the homepage.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Homepage
- {
- get
- {
- string value = _Homepage;
- GetHomepage(ref value);
- return _Homepage = value;
- }
-
- set
- {
- string oldValue = _Homepage;
- SetHomepage(oldValue, ref value);
- if (oldValue != value)
- {
- _Homepage = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Homepage { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CustomItem.cs b/Jellyfin.Data/Entities/Libraries/CustomItem.cs
index ffe06db249..6a4f0a5378 100644
--- a/Jellyfin.Data/Entities/Libraries/CustomItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/CustomItem.cs
@@ -1,71 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CustomItem : LibraryItem
+ ///
+ /// An entity representing a custom item.
+ ///
+ public class CustomItem : LibraryItem, IHasReleases
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected CustomItem()
+ public CustomItem()
{
CustomItemMetadata = new HashSet();
Releases = new HashSet();
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets a collection containing the metadata for this item.
///
- public static CustomItem CreateCustomItemUnsafe()
- {
- return new CustomItem();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public CustomItem(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.CustomItemMetadata = new HashSet();
- this.Releases = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public static CustomItem Create(Guid urlid, DateTime dateadded)
- {
- return new CustomItem(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("CustomItemMetadata_CustomItemMetadata_Id")]
public virtual ICollection CustomItemMetadata { get; protected set; }
- [ForeignKey("Release_Releases_Id")]
+ ///
public virtual ICollection Releases { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
index 8606302d7d..bc18355281 100644
--- a/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/CustomItemMetadata.cs
@@ -1,83 +1,36 @@
-#pragma warning disable CS1591
-
using System;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class CustomItemMetadata : Metadata
+ ///
+ /// An entity containing metadata for a custom item.
+ ///
+ public class CustomItemMetadata : Metadata
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The title or name of the object.
+ /// ISO-639-3 3-character language codes.
+ /// The item.
+ public CustomItemMetadata(string title, string language, CustomItem item) : base(title, language)
+ {
+ if (item == null)
+ {
+ throw new ArgumentNullException(nameof(item));
+ }
+
+ item.CustomItemMetadata.Add(this);
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected CustomItemMetadata()
{
- Init();
}
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static CustomItemMetadata CreateCustomItemMetadataUnsafe()
- {
- return new CustomItemMetadata();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public CustomItemMetadata(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
- {
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_customitem0 == null)
- {
- throw new ArgumentNullException(nameof(_customitem0));
- }
-
- _customitem0.CustomItemMetadata.Add(this);
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public static CustomItemMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, CustomItem _customitem0)
- {
- return new CustomItemMetadata(title, language, dateadded, datemodified, _customitem0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Episode.cs b/Jellyfin.Data/Entities/Libraries/Episode.cs
index 3315b3e30b..430a11e3c8 100644
--- a/Jellyfin.Data/Entities/Libraries/Episode.cs
+++ b/Jellyfin.Data/Entities/Libraries/Episode.cs
@@ -1,118 +1,52 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Episode : LibraryItem
+ ///
+ /// An entity representing an episode.
+ ///
+ public class Episode : LibraryItem, IHasReleases
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Episode()
+ /// The season.
+ public Episode(Season season)
{
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
+ if (season == null)
+ {
+ throw new ArgumentNullException(nameof(season));
+ }
+
+ season.Episodes.Add(this);
Releases = new HashSet();
EpisodeMetadata = new HashSet();
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the class.
///
- public static Episode CreateEpisodeUnsafe()
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected Episode()
{
- return new Episode();
}
///
- /// Public constructor with required data.
+ /// Gets or sets the episode number.
///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- ///
- public Episode(Guid urlid, DateTime dateadded, Season _season0)
- {
- // NOTE: This class has one-to-one associations with LibraryRoot, LibraryItem and CollectionItem.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
+ public int? EpisodeNumber { get; set; }
- this.UrlId = urlid;
-
- if (_season0 == null)
- {
- throw new ArgumentNullException(nameof(_season0));
- }
-
- _season0.Episodes.Add(this);
-
- this.Releases = new HashSet();
- this.EpisodeMetadata = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- ///
- public static Episode Create(Guid urlid, DateTime dateadded, Season _season0)
- {
- return new Episode(urlid, dateadded, _season0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for EpisodeNumber.
- ///
- protected int? _EpisodeNumber;
- ///
- /// When provided in a partial class, allows value of EpisodeNumber to be changed before setting.
- ///
- partial void SetEpisodeNumber(int? oldValue, ref int? newValue);
- ///
- /// When provided in a partial class, allows value of EpisodeNumber to be changed before returning.
- ///
- partial void GetEpisodeNumber(ref int? result);
-
- public int? EpisodeNumber
- {
- get
- {
- int? value = _EpisodeNumber;
- GetEpisodeNumber(ref value);
- return _EpisodeNumber = value;
- }
-
- set
- {
- int? oldValue = _EpisodeNumber;
- SetEpisodeNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _EpisodeNumber = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("Release_Releases_Id")]
+ ///
public virtual ICollection Releases { get; protected set; }
- [ForeignKey("EpisodeMetadata_EpisodeMetadata_Id")]
+
+ ///
+ /// Gets or sets a collection containing the metadata for this episode.
+ ///
public virtual ICollection EpisodeMetadata { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
index f20ed3573f..348100cb4c 100644
--- a/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/EpisodeMetadata.cs
@@ -1,198 +1,67 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class EpisodeMetadata : Metadata
+ ///
+ /// An entity containing metadata for an .
+ ///
+ public class EpisodeMetadata : Metadata
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The title or name of the object.
+ /// ISO-639-3 3-character language codes.
+ /// The episode.
+ public EpisodeMetadata(string title, string language, Episode episode) : base(title, language)
+ {
+ if (episode == null)
+ {
+ throw new ArgumentNullException(nameof(episode));
+ }
+
+ episode.EpisodeMetadata.Add(this);
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected EpisodeMetadata()
{
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static EpisodeMetadata CreateEpisodeMetadataUnsafe()
- {
- return new EpisodeMetadata();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public EpisodeMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
- {
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_episode0 == null)
- {
- throw new ArgumentNullException(nameof(_episode0));
- }
-
- _episode0.EpisodeMetadata.Add(this);
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public static EpisodeMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Episode _episode0)
- {
- return new EpisodeMetadata(title, language, dateadded, datemodified, _episode0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Outline.
- ///
- protected string _Outline;
- ///
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- ///
- partial void SetOutline(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- ///
- partial void GetOutline(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the outline.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
+ public string Outline { get; set; }
///
- /// Backing field for Plot.
- ///
- protected string _Plot;
- ///
- /// When provided in a partial class, allows value of Plot to be changed before setting.
- ///
- partial void SetPlot(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Plot to be changed before returning.
- ///
- partial void GetPlot(ref string result);
-
- ///
- /// Max length = 65535
+ /// Gets or sets the plot.
///
+ ///
+ /// Max length = 65535.
+ ///
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot
- {
- get
- {
- string value = _Plot;
- GetPlot(ref value);
- return _Plot = value;
- }
-
- set
- {
- string oldValue = _Plot;
- SetPlot(oldValue, ref value);
- if (oldValue != value)
- {
- _Plot = value;
- }
- }
- }
+ public string Plot { get; set; }
///
- /// Backing field for Tagline.
- ///
- protected string _Tagline;
- ///
- /// When provided in a partial class, allows value of Tagline to be changed before setting.
- ///
- partial void SetTagline(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Tagline to be changed before returning.
- ///
- partial void GetTagline(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the tagline.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Tagline
- {
- get
- {
- string value = _Tagline;
- GetTagline(ref value);
- return _Tagline = value;
- }
-
- set
- {
- string oldValue = _Tagline;
- SetTagline(oldValue, ref value);
- if (oldValue != value)
- {
- _Tagline = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
+ public string Tagline { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Genre.cs b/Jellyfin.Data/Entities/Libraries/Genre.cs
index c0b391ac8c..aeedd7bfde 100644
--- a/Jellyfin.Data/Entities/Libraries/Genre.cs
+++ b/Jellyfin.Data/Entities/Libraries/Genre.cs
@@ -1,162 +1,75 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Genre
+ ///
+ /// An entity representing a genre.
+ ///
+ public class Genre : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Genre()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static Genre CreateGenreUnsafe()
- {
- return new Genre();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- public Genre(string name, Metadata _metadata0)
+ /// The name.
+ /// The metadata.
+ public Genre(string name, Metadata metadata)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
+ Name = name;
- if (_metadata0 == null)
+ if (metadata == null)
{
- throw new ArgumentNullException(nameof(_metadata0));
+ throw new ArgumentNullException(nameof(metadata));
}
- _metadata0.Genres.Add(this);
-
- Init();
+ metadata.Genres.Add(this);
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- ///
- ///
- public static Genre Create(string name, Metadata _metadata0)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected Genre()
{
- return new Genre(name, _metadata0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Name.
- ///
- internal string _Name;
- ///
- /// When provided in a partial class, allows value of Name to be changed before setting.
- ///
- partial void SetName(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Name to be changed before returning.
- ///
- partial void GetName(ref string result);
-
- ///
- /// Indexed, Required, Max length = 255
+ /// Gets or sets the name.
///
+ ///
+ /// Indexed, Required, Max length = 255.
+ ///
[Required]
[MaxLength(255)]
[StringLength(255)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public uint RowVersion { get; protected set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Library.cs b/Jellyfin.Data/Entities/Libraries/Library.cs
index 9a97a3b00c..4f82a2e2a7 100644
--- a/Jellyfin.Data/Entities/Libraries/Library.cs
+++ b/Jellyfin.Data/Entities/Libraries/Library.cs
@@ -1,153 +1,76 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Library
+ ///
+ /// An entity representing a library.
+ ///
+ public class Library : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Library()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static Library CreateLibraryUnsafe()
- {
- return new Library();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
+ /// The name of the library.
public Library(string name)
{
- if (string.IsNullOrEmpty(name))
+ if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
-
- Init();
+ Name = name;
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- ///
- public static Library Create(string name)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected Library()
{
- return new Library(name);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Name.
- ///
- protected string _Name;
- ///
- /// When provided in a partial class, allows value of Name to be changed before setting.
- ///
- partial void SetName(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Name to be changed before returning.
- ///
- partial void GetName(ref string result);
-
- ///
- /// Required, Max length = 1024
+ /// Gets or sets the name.
///
+ ///
+ /// Required, Max length = 128.
+ ///
[Required]
- [MaxLength(1024)]
- [StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
-
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
+ [MaxLength(128)]
+ [StringLength(128)]
+ public string Name { get; set; }
///
- /// Required, ConcurrenyToken.
+ /// Gets or sets the root path of the library.
///
+ ///
+ /// Required.
+ ///
+ [Required]
+ public string Path { get; set; }
+
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
index b5f0323653..a9167aa7fd 100644
--- a/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
+++ b/Jellyfin.Data/Entities/Libraries/LibraryItem.cs
@@ -1,175 +1,63 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public abstract partial class LibraryItem
+ ///
+ /// An entity representing a library item.
+ ///
+ public abstract class LibraryItem : IHasConcurrencyToken
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The library of this item.
+ protected LibraryItem(Library library)
+ {
+ DateAdded = DateTime.UtcNow;
+ Library = library;
+ }
///
- /// Default constructor. Protected due to being abstract.
+ /// Initializes a new instance of the class.
///
protected LibraryItem()
{
- Init();
}
///
- /// Public constructor with required data.
+ /// Gets or sets the id.
///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- protected LibraryItem(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
-
- Init();
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for UrlId.
+ /// Gets or sets the date this library item was added.
///
- internal Guid _UrlId;
- ///
- /// When provided in a partial class, allows value of UrlId to be changed before setting.
- ///
- partial void SetUrlId(Guid oldValue, ref Guid newValue);
- ///
- /// When provided in a partial class, allows value of UrlId to be changed before returning.
- ///
- partial void GetUrlId(ref Guid result);
+ public DateTime DateAdded { get; protected set; }
- ///
- /// Indexed, Required
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- ///
- [Required]
- public Guid UrlId
- {
- get
- {
- Guid value = _UrlId;
- GetUrlId(ref value);
- return _UrlId = value;
- }
-
- set
- {
- Guid oldValue = _UrlId;
- SetUrlId(oldValue, ref value);
- if (oldValue != value)
- {
- _UrlId = value;
- }
- }
- }
-
- ///
- /// Backing field for DateAdded.
- ///
- protected DateTime _DateAdded;
- ///
- /// When provided in a partial class, allows value of DateAdded to be changed before setting.
- ///
- partial void SetDateAdded(DateTime oldValue, ref DateTime newValue);
- ///
- /// When provided in a partial class, allows value of DateAdded to be changed before returning.
- ///
- partial void GetDateAdded(ref DateTime result);
-
- ///
- /// Required.
- ///
- [Required]
- public DateTime DateAdded
- {
- get
- {
- DateTime value = _DateAdded;
- GetDateAdded(ref value);
- return _DateAdded = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateAdded;
- SetDateAdded(oldValue, ref value);
- if (oldValue != value)
- {
- _DateAdded = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
+ public uint RowVersion { get; protected set; }
+ ///
+ /// Gets or sets the library of this item.
+ ///
+ ///
+ /// Required.
+ ///
+ [Required]
+ public virtual Library Library { get; set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- ///
- /// Required.
- ///
- [ForeignKey("LibraryRoot_Id")]
- public virtual LibraryRoot LibraryRoot { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs b/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs
deleted file mode 100644
index bbd9044477..0000000000
--- a/Jellyfin.Data/Entities/Libraries/LibraryRoot.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-#pragma warning disable CS1591
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Jellyfin.Data.Entities.Libraries
-{
- public partial class LibraryRoot
- {
- partial void Init();
-
- ///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- ///
- protected LibraryRoot()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static LibraryRoot CreateLibraryRootUnsafe()
- {
- return new LibraryRoot();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// Absolute Path.
- public LibraryRoot(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException(nameof(path));
- }
-
- this.Path = path;
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// Absolute Path.
- public static LibraryRoot Create(string path)
- {
- return new LibraryRoot(path);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
- /// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
-
- ///
- /// Backing field for Path.
- ///
- protected string _Path;
- ///
- /// When provided in a partial class, allows value of Path to be changed before setting.
- ///
- partial void SetPath(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Path to be changed before returning.
- ///
- partial void GetPath(ref string result);
-
- ///
- /// Required, Max length = 65535
- /// Absolute Path.
- ///
- [Required]
- [MaxLength(65535)]
- [StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
-
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
-
- ///
- /// Backing field for NetworkPath.
- ///
- protected string _NetworkPath;
- ///
- /// When provided in a partial class, allows value of NetworkPath to be changed before setting.
- ///
- partial void SetNetworkPath(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of NetworkPath to be changed before returning.
- ///
- partial void GetNetworkPath(ref string result);
-
- ///
- /// Max length = 65535
- /// Absolute network path, for example for transcoding sattelites.
- ///
- [MaxLength(65535)]
- [StringLength(65535)]
- public string NetworkPath
- {
- get
- {
- string value = _NetworkPath;
- GetNetworkPath(ref value);
- return _NetworkPath = value;
- }
-
- set
- {
- string oldValue = _NetworkPath;
- SetNetworkPath(oldValue, ref value);
- if (oldValue != value)
- {
- _NetworkPath = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
- [ConcurrencyCheck]
- [Required]
- public uint RowVersion { get; set; }
-
- public void OnSavingChanges()
- {
- RowVersion++;
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- ///
- /// Required.
- ///
- [ForeignKey("Library_Id")]
- public virtual Library Library { get; set; }
- }
-}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFile.cs b/Jellyfin.Data/Entities/Libraries/MediaFile.cs
index c9efdb143b..8bc649c98f 100644
--- a/Jellyfin.Data/Entities/Libraries/MediaFile.cs
+++ b/Jellyfin.Data/Entities/Libraries/MediaFile.cs
@@ -1,212 +1,94 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Enums;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MediaFile
+ ///
+ /// An entity representing a file on disk.
+ ///
+ public class MediaFile : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected MediaFile()
- {
- MediaFileStreams = new HashSet();
-
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static MediaFile CreateMediaFileUnsafe()
- {
- return new MediaFile();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// Relative to the LibraryRoot.
- ///
- ///
- public MediaFile(string path, Enums.MediaFileKind kind, Release _release0)
+ /// The path relative to the LibraryRoot.
+ /// The file kind.
+ /// The release.
+ public MediaFile(string path, MediaFileKind kind, Release release)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
- this.Path = path;
+ Path = path;
+ Kind = kind;
- this.Kind = kind;
-
- if (_release0 == null)
+ if (release == null)
{
- throw new ArgumentNullException(nameof(_release0));
+ throw new ArgumentNullException(nameof(release));
}
- _release0.MediaFiles.Add(this);
+ release.MediaFiles.Add(this);
- this.MediaFileStreams = new HashSet();
-
- Init();
+ MediaFileStreams = new HashSet();
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- /// Relative to the LibraryRoot.
- ///
- ///
- public static MediaFile Create(string path, Enums.MediaFileKind kind, Release _release0)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected MediaFile()
{
- return new MediaFile(path, kind, _release0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Path.
- ///
- protected string _Path;
- ///
- /// When provided in a partial class, allows value of Path to be changed before setting.
- ///
- partial void SetPath(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Path to be changed before returning.
- ///
- partial void GetPath(ref string result);
-
- ///
- /// Required, Max length = 65535
- /// Relative to the LibraryRoot.
+ /// Gets or sets the path relative to the library root.
///
+ ///
+ /// Required, Max length = 65535.
+ ///
[Required]
[MaxLength(65535)]
[StringLength(65535)]
- public string Path
- {
- get
- {
- string value = _Path;
- GetPath(ref value);
- return _Path = value;
- }
-
- set
- {
- string oldValue = _Path;
- SetPath(oldValue, ref value);
- if (oldValue != value)
- {
- _Path = value;
- }
- }
- }
+ public string Path { get; set; }
///
- /// Backing field for Kind.
+ /// Gets or sets the kind of media file.
///
- protected Enums.MediaFileKind _Kind;
- ///
- /// When provided in a partial class, allows value of Kind to be changed before setting.
- ///
- partial void SetKind(Enums.MediaFileKind oldValue, ref Enums.MediaFileKind newValue);
- ///
- /// When provided in a partial class, allows value of Kind to be changed before returning.
- ///
- partial void GetKind(ref Enums.MediaFileKind result);
-
- ///
+ ///
/// Required.
- ///
- [Required]
- public Enums.MediaFileKind Kind
- {
- get
- {
- Enums.MediaFileKind value = _Kind;
- GetKind(ref value);
- return _Kind = value;
- }
+ ///
+ public MediaFileKind Kind { get; set; }
- set
- {
- Enums.MediaFileKind oldValue = _Kind;
- SetKind(oldValue, ref value);
- if (oldValue != value)
- {
- _Kind = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets a collection containing the streams in this file.
+ ///
+ public virtual ICollection MediaFileStreams { get; protected set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("MediaFileStream_MediaFileStreams_Id")]
- public virtual ICollection MediaFileStreams { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
index f1f26ecbb9..5b03e260e2 100644
--- a/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
+++ b/Jellyfin.Data/Entities/Libraries/MediaFileStream.cs
@@ -1,155 +1,67 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MediaFileStream
+ ///
+ /// An entity representing a stream in a media file.
+ ///
+ public class MediaFileStream : IHasConcurrencyToken
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The number of this stream.
+ /// The media file.
+ public MediaFileStream(int streamNumber, MediaFile mediaFile)
+ {
+ StreamNumber = streamNumber;
+
+ if (mediaFile == null)
+ {
+ throw new ArgumentNullException(nameof(mediaFile));
+ }
+
+ mediaFile.MediaFileStreams.Add(this);
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected MediaFileStream()
{
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets the id.
///
- public static MediaFileStream CreateMediaFileStreamUnsafe()
- {
- return new MediaFileStream();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- public MediaFileStream(int streamnumber, MediaFile _mediafile0)
- {
- this.StreamNumber = streamnumber;
-
- if (_mediafile0 == null)
- {
- throw new ArgumentNullException(nameof(_mediafile0));
- }
-
- _mediafile0.MediaFileStreams.Add(this);
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- public static MediaFileStream Create(int streamnumber, MediaFile _mediafile0)
- {
- return new MediaFileStream(streamnumber, _mediafile0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for StreamNumber.
+ /// Gets or sets the stream number.
///
- protected int _StreamNumber;
- ///
- /// When provided in a partial class, allows value of StreamNumber to be changed before setting.
- ///
- partial void SetStreamNumber(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of StreamNumber to be changed before returning.
- ///
- partial void GetStreamNumber(ref int result);
-
- ///
+ ///
/// Required.
- ///
- [Required]
- public int StreamNumber
- {
- get
- {
- int value = _StreamNumber;
- GetStreamNumber(ref value);
- return _StreamNumber = value;
- }
+ ///
+ public int StreamNumber { get; set; }
- set
- {
- int oldValue = _StreamNumber;
- SetStreamNumber(oldValue, ref value);
- if (oldValue != value)
- {
- _StreamNumber = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Metadata.cs b/Jellyfin.Data/Entities/Libraries/Metadata.cs
index 449e807dec..877bb5fbdc 100644
--- a/Jellyfin.Data/Entities/Libraries/Metadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/Metadata.cs
@@ -1,399 +1,165 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public abstract partial class Metadata
+ ///
+ /// An abstract class that holds metadata.
+ ///
+ public abstract class Metadata : IHasArtwork, IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to being abstract.
- ///
- protected Metadata()
- {
- PersonRoles = new HashSet();
- Genres = new HashSet();
- Artwork = new HashSet();
- Ratings = new HashSet();
- Sources = new HashSet();
-
- Init();
- }
-
- ///
- /// Public constructor with required data.
+ /// Initializes a new instance of the class.
///
/// The title or name of the object.
/// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- protected Metadata(string title, string language, DateTime dateadded, DateTime datemodified)
+ protected Metadata(string title, string language)
{
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException(nameof(title));
}
- this.Title = title;
-
if (string.IsNullOrEmpty(language))
{
throw new ArgumentNullException(nameof(language));
}
- this.Language = language;
+ Title = title;
+ Language = language;
+ DateAdded = DateTime.UtcNow;
+ DateModified = DateAdded;
- this.PersonRoles = new HashSet();
- this.Genres = new HashSet();
- this.Artwork = new HashSet();
- this.Ratings = new HashSet();
- this.Sources = new HashSet();
-
- Init();
+ PersonRoles = new HashSet();
+ Genres = new HashSet();
+ Artwork = new HashSet();
+ Ratings = new HashSet();
+ Sources = new HashSet();
}
- /*************************************************************************
- * Properties
- *************************************************************************/
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Default constructor. Protected due to being abstract.
+ ///
+ protected Metadata()
+ {
+ }
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Title.
- ///
- protected string _Title;
- ///
- /// When provided in a partial class, allows value of Title to be changed before setting.
- ///
- partial void SetTitle(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Title to be changed before returning.
- ///
- partial void GetTitle(ref string result);
-
- ///
- /// Required, Max length = 1024
- /// The title or name of the object.
+ /// Gets or sets the title.
///
+ ///
+ /// Required, Max length = 1024.
+ ///
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Title
- {
- get
- {
- string value = _Title;
- GetTitle(ref value);
- return _Title = value;
- }
-
- set
- {
- string oldValue = _Title;
- SetTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _Title = value;
- }
- }
- }
+ public string Title { get; set; }
///
- /// Backing field for OriginalTitle.
- ///
- protected string _OriginalTitle;
- ///
- /// When provided in a partial class, allows value of OriginalTitle to be changed before setting.
- ///
- partial void SetOriginalTitle(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of OriginalTitle to be changed before returning.
- ///
- partial void GetOriginalTitle(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the original title.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string OriginalTitle
- {
- get
- {
- string value = _OriginalTitle;
- GetOriginalTitle(ref value);
- return _OriginalTitle = value;
- }
-
- set
- {
- string oldValue = _OriginalTitle;
- SetOriginalTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _OriginalTitle = value;
- }
- }
- }
+ public string OriginalTitle { get; set; }
///
- /// Backing field for SortTitle.
- ///
- protected string _SortTitle;
- ///
- /// When provided in a partial class, allows value of SortTitle to be changed before setting.
- ///
- partial void SetSortTitle(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of SortTitle to be changed before returning.
- ///
- partial void GetSortTitle(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the sort title.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string SortTitle
- {
- get
- {
- string value = _SortTitle;
- GetSortTitle(ref value);
- return _SortTitle = value;
- }
-
- set
- {
- string oldValue = _SortTitle;
- SetSortTitle(oldValue, ref value);
- if (oldValue != value)
- {
- _SortTitle = value;
- }
- }
- }
+ public string SortTitle { get; set; }
///
- /// Backing field for Language.
+ /// Gets or sets the language.
///
- protected string _Language;
- ///
- /// When provided in a partial class, allows value of Language to be changed before setting.
- ///
- partial void SetLanguage(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Language to be changed before returning.
- ///
- partial void GetLanguage(ref string result);
-
- ///
- /// Required, Min length = 3, Max length = 3
+ ///
+ /// Required, Min length = 3, Max length = 3.
/// ISO-639-3 3-character language codes.
- ///
+ ///
[Required]
[MinLength(3)]
[MaxLength(3)]
[StringLength(3)]
- public string Language
- {
- get
- {
- string value = _Language;
- GetLanguage(ref value);
- return _Language = value;
- }
-
- set
- {
- string oldValue = _Language;
- SetLanguage(oldValue, ref value);
- if (oldValue != value)
- {
- _Language = value;
- }
- }
- }
+ public string Language { get; set; }
///
- /// Backing field for ReleaseDate.
+ /// Gets or sets the release date.
///
- protected DateTimeOffset? _ReleaseDate;
- ///
- /// When provided in a partial class, allows value of ReleaseDate to be changed before setting.
- ///
- partial void SetReleaseDate(DateTimeOffset? oldValue, ref DateTimeOffset? newValue);
- ///
- /// When provided in a partial class, allows value of ReleaseDate to be changed before returning.
- ///
- partial void GetReleaseDate(ref DateTimeOffset? result);
-
- public DateTimeOffset? ReleaseDate
- {
- get
- {
- DateTimeOffset? value = _ReleaseDate;
- GetReleaseDate(ref value);
- return _ReleaseDate = value;
- }
-
- set
- {
- DateTimeOffset? oldValue = _ReleaseDate;
- SetReleaseDate(oldValue, ref value);
- if (oldValue != value)
- {
- _ReleaseDate = value;
- }
- }
- }
+ public DateTimeOffset? ReleaseDate { get; set; }
///
- /// Backing field for DateAdded.
+ /// Gets or sets the date added.
///
- protected DateTime _DateAdded;
- ///
- /// When provided in a partial class, allows value of DateAdded to be changed before setting.
- ///
- partial void SetDateAdded(DateTime oldValue, ref DateTime newValue);
- ///
- /// When provided in a partial class, allows value of DateAdded to be changed before returning.
- ///
- partial void GetDateAdded(ref DateTime result);
-
- ///
+ ///
/// Required.
- ///
- [Required]
- public DateTime DateAdded
- {
- get
- {
- DateTime value = _DateAdded;
- GetDateAdded(ref value);
- return _DateAdded = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateAdded;
- SetDateAdded(oldValue, ref value);
- if (oldValue != value)
- {
- _DateAdded = value;
- }
- }
- }
+ ///
+ public DateTime DateAdded { get; protected set; }
///
- /// Backing field for DateModified.
+ /// Gets or sets the date modified.
///
- protected DateTime _DateModified;
- ///
- /// When provided in a partial class, allows value of DateModified to be changed before setting.
- ///
- partial void SetDateModified(DateTime oldValue, ref DateTime newValue);
- ///
- /// When provided in a partial class, allows value of DateModified to be changed before returning.
- ///
- partial void GetDateModified(ref DateTime result);
-
- ///
+ ///
/// Required.
- ///
- [Required]
- public DateTime DateModified
- {
- get
- {
- DateTime value = _DateModified;
- GetDateModified(ref value);
- return _DateModified = value;
- }
-
- internal set
- {
- DateTime oldValue = _DateModified;
- SetDateModified(oldValue, ref value);
- if (oldValue != value)
- {
- _DateModified = value;
- }
- }
- }
+ ///
+ public DateTime DateModified { get; set; }
///
- /// Required, ConcurrenyToken.
+ /// Gets or sets the row version.
///
+ ///
+ /// Required, ConcurrencyToken.
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets a collection containing the person roles for this item.
+ ///
+ public virtual ICollection PersonRoles { get; protected set; }
+
+ ///
+ /// Gets or sets a collection containing the generes for this item.
+ ///
+ public virtual ICollection Genres { get; protected set; }
+
+ ///
+ public virtual ICollection Artwork { get; protected set; }
+
+ ///
+ /// Gets or sets a collection containing the ratings for this item.
+ ///
+ public virtual ICollection Ratings { get; protected set; }
+
+ ///
+ /// Gets or sets a collection containing the metadata sources for this item.
+ ///
+ public virtual ICollection Sources { get; protected set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection PersonRoles { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection Genres { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection Artwork { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection Ratings { get; protected set; }
-
- [ForeignKey("PersonRole_PersonRoles_Id")]
- public virtual ICollection Sources { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
index d5462113b0..a18a612bcd 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs
@@ -1,35 +1,19 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MetadataProvider
+ ///
+ /// An entity representing a metadata provider.
+ ///
+ public class MetadataProvider : IHasConcurrencyToken
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected MetadataProvider()
- {
- Init();
- }
-
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static MetadataProvider CreateMetadataProviderUnsafe()
- {
- return new MetadataProvider();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
+ /// The name of the metadata provider.
public MetadataProvider(string name)
{
if (string.IsNullOrEmpty(name))
@@ -37,117 +21,47 @@ namespace Jellyfin.Data.Entities.Libraries
throw new ArgumentNullException(nameof(name));
}
- this.Name = name;
-
- Init();
+ Name = name;
}
///
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the class.
///
- ///
- public static MetadataProvider Create(string name)
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected MetadataProvider()
{
- return new MetadataProvider(name);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
///
- /// Backing field for Id.
+ /// Gets or sets the id.
///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for Name.
- ///
- protected string _Name;
- ///
- /// When provided in a partial class, allows value of Name to be changed before setting.
- ///
- partial void SetName(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Name to be changed before returning.
- ///
- partial void GetName(ref string result);
-
- ///
- /// Required, Max length = 1024
+ /// Gets or sets the name.
///
+ ///
+ /// Required, Max length = 1024.
+ ///
[Required]
[MaxLength(1024)]
[StringLength(1024)]
- public string Name
- {
- get
- {
- string value = _Name;
- GetName(ref value);
- return _Name = value;
- }
+ public string Name { get; set; }
- set
- {
- string oldValue = _Name;
- SetName(oldValue, ref value);
- if (oldValue != value)
- {
- _Name = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
index fed9d4f0bf..6e6de598e8 100644
--- a/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
+++ b/Jellyfin.Data/Entities/Libraries/MetadataProviderId.cs
@@ -1,201 +1,83 @@
-#pragma warning disable CS1591
-
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MetadataProviderId
+ ///
+ /// An entity representing a unique identifier for a metadata provider.
+ ///
+ public class MetadataProviderId : IHasConcurrencyToken
{
- partial void Init();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The provider id.
+ /// The metadata entity.
+ public MetadataProviderId(string providerId, Metadata metadata)
+ {
+ if (string.IsNullOrEmpty(providerId))
+ {
+ throw new ArgumentNullException(nameof(providerId));
+ }
+
+ ProviderId = providerId;
+
+ if (metadata == null)
+ {
+ throw new ArgumentNullException(nameof(metadata));
+ }
+
+ metadata.Sources.Add(this);
+ }
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
protected MetadataProviderId()
{
- // NOTE: This class has one-to-one associations with MetadataProviderId.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- Init();
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Gets or sets the id.
///
- public static MetadataProviderId CreateMetadataProviderIdUnsafe()
- {
- return new MetadataProviderId();
- }
-
- ///
- /// Public constructor with required data.
- ///
- ///
- ///
- ///
- ///
- ///
- public MetadataProviderId(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
- {
- // NOTE: This class has one-to-one associations with MetadataProviderId.
- // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.
-
- if (string.IsNullOrEmpty(providerid))
- {
- throw new ArgumentNullException(nameof(providerid));
- }
-
- this.ProviderId = providerid;
-
- if (_metadata0 == null)
- {
- throw new ArgumentNullException(nameof(_metadata0));
- }
-
- _metadata0.Sources.Add(this);
-
- if (_person1 == null)
- {
- throw new ArgumentNullException(nameof(_person1));
- }
-
- _person1.Sources.Add(this);
-
- if (_personrole2 == null)
- {
- throw new ArgumentNullException(nameof(_personrole2));
- }
-
- _personrole2.Sources.Add(this);
-
- if (_ratingsource3 == null)
- {
- throw new ArgumentNullException(nameof(_ratingsource3));
- }
-
- _ratingsource3.Source = this;
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- ///
- ///
- ///
- ///
- ///
- public static MetadataProviderId Create(string providerid, Metadata _metadata0, Person _person1, PersonRole _personrole2, RatingSource _ratingsource3)
- {
- return new MetadataProviderId(providerid, _metadata0, _person1, _personrole2, _ratingsource3);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Id.
- ///
- internal int _Id;
- ///
- /// When provided in a partial class, allows value of Id to be changed before setting.
- ///
- partial void SetId(int oldValue, ref int newValue);
- ///
- /// When provided in a partial class, allows value of Id to be changed before returning.
- ///
- partial void GetId(ref int result);
-
- ///
+ ///
/// Identity, Indexed, Required.
- ///
- [Key]
- [Required]
+ ///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- public int Id
- {
- get
- {
- int value = _Id;
- GetId(ref value);
- return _Id = value;
- }
-
- protected set
- {
- int oldValue = _Id;
- SetId(oldValue, ref value);
- if (oldValue != value)
- {
- _Id = value;
- }
- }
- }
+ public int Id { get; protected set; }
///
- /// Backing field for ProviderId.
- ///
- protected string _ProviderId;
- ///
- /// When provided in a partial class, allows value of ProviderId to be changed before setting.
- ///
- partial void SetProviderId(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of ProviderId to be changed before returning.
- ///
- partial void GetProviderId(ref string result);
-
- ///
- /// Required, Max length = 255
+ /// Gets or sets the provider id.
///
+ ///
+ /// Required, Max length = 255.
+ ///
[Required]
[MaxLength(255)]
[StringLength(255)]
- public string ProviderId
- {
- get
- {
- string value = _ProviderId;
- GetProviderId(ref value);
- return _ProviderId = value;
- }
+ public string ProviderId { get; set; }
- set
- {
- string oldValue = _ProviderId;
- SetProviderId(oldValue, ref value);
- if (oldValue != value)
- {
- _ProviderId = value;
- }
- }
- }
-
- ///
- /// Required, ConcurrenyToken.
- ///
+ ///
[ConcurrencyCheck]
- [Required]
public uint RowVersion { get; set; }
+ ///
+ /// Gets or sets the metadata provider.
+ ///
+ ///
+ /// Required.
+ ///
+ public virtual MetadataProvider MetadataProvider { get; set; }
+
+ ///
public void OnSavingChanges()
{
RowVersion++;
}
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- ///
- /// Required.
- ///
- [ForeignKey("MetadataProvider_Id")]
- public virtual MetadataProvider MetadataProvider { get; set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/Movie.cs b/Jellyfin.Data/Entities/Libraries/Movie.cs
index e7d27b5519..0a8cc83dda 100644
--- a/Jellyfin.Data/Entities/Libraries/Movie.cs
+++ b/Jellyfin.Data/Entities/Libraries/Movie.cs
@@ -1,72 +1,28 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class Movie : LibraryItem
+ ///
+ /// An entity representing a movie.
+ ///
+ public class Movie : LibraryItem, IHasReleases
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected Movie()
+ public Movie()
{
Releases = new HashSet();
MovieMetadata = new HashSet();
-
- Init();
}
- ///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- ///
- public static Movie CreateMovieUnsafe()
- {
- return new Movie();
- }
-
- ///
- /// Public constructor with required data.
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public Movie(Guid urlid, DateTime dateadded)
- {
- this.UrlId = urlid;
-
- this.Releases = new HashSet();
- this.MovieMetadata = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// This is whats gets displayed in the Urls and API requests. This could also be a string.
- /// The date the object was added.
- public static Movie Create(Guid urlid, DateTime dateadded)
- {
- return new Movie(urlid, dateadded);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Release_Releases_Id")]
+ ///
public virtual ICollection Releases { get; protected set; }
- [ForeignKey("MovieMetadata_MovieMetadata_Id")]
+ ///
+ /// Gets or sets a collection containing the metadata for this movie.
+ ///
public virtual ICollection MovieMetadata { get; protected set; }
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
index f65da11d20..31102bf130 100644
--- a/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/MovieMetadata.cs
@@ -1,244 +1,85 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MovieMetadata : Metadata
+ ///
+ /// An entity holding the metadata for a movie.
+ ///
+ public class MovieMetadata : Metadata, IHasCompanies
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected MovieMetadata()
+ /// The title or name of the movie.
+ /// ISO-639-3 3-character language codes.
+ /// The movie.
+ public MovieMetadata(string title, string language, Movie movie) : base(title, language)
{
Studios = new HashSet();
- Init();
+ movie.MovieMetadata.Add(this);
}
///
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
+ /// Initializes a new instance of the class.
///
- public static MovieMetadata CreateMovieMetadataUnsafe()
+ ///
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ ///
+ protected MovieMetadata()
{
- return new MovieMetadata();
}
///
- /// Public constructor with required data.
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public MovieMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
- {
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_movie0 == null)
- {
- throw new ArgumentNullException(nameof(_movie0));
- }
-
- _movie0.MovieMetadata.Add(this);
-
- this.Studios = new HashSet();
-
- Init();
- }
-
- ///
- /// Static create function (for use in LINQ queries, etc.)
- ///
- /// The title or name of the object.
- /// ISO-639-3 3-character language codes.
- /// The date the object was added.
- /// The date the object was last modified.
- ///
- public static MovieMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Movie _movie0)
- {
- return new MovieMetadata(title, language, dateadded, datemodified, _movie0);
- }
-
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- ///
- /// Backing field for Outline.
- ///
- protected string _Outline;
- ///
- /// When provided in a partial class, allows value of Outline to be changed before setting.
- ///
- partial void SetOutline(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Outline to be changed before returning.
- ///
- partial void GetOutline(ref string result);
-
- ///
- /// Max length = 1024
+ /// Gets or sets the outline.
///
+ ///
+ /// Max length = 1024.
+ ///
[MaxLength(1024)]
[StringLength(1024)]
- public string Outline
- {
- get
- {
- string value = _Outline;
- GetOutline(ref value);
- return _Outline = value;
- }
-
- set
- {
- string oldValue = _Outline;
- SetOutline(oldValue, ref value);
- if (oldValue != value)
- {
- _Outline = value;
- }
- }
- }
+ public string Outline { get; set; }
///
- /// Backing field for Plot.
+ /// Gets or sets the tagline.
///
- protected string _Plot;
- ///
- /// When provided in a partial class, allows value of Plot to be changed before setting.
- ///
- partial void SetPlot(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Plot to be changed before returning.
- ///
- partial void GetPlot(ref string result);
+ ///
+ /// Max length = 1024.
+ ///
+ [MaxLength(1024)]
+ [StringLength(1024)]
+ public string Tagline { get; set; }
///
- /// Max length = 65535
+ /// Gets or sets the plot.
///
+ ///
+ /// Max length = 65535.
+ ///
[MaxLength(65535)]
[StringLength(65535)]
- public string Plot
- {
- get
- {
- string value = _Plot;
- GetPlot(ref value);
- return _Plot = value;
- }
-
- set
- {
- string oldValue = _Plot;
- SetPlot(oldValue, ref value);
- if (oldValue != value)
- {
- _Plot = value;
- }
- }
- }
+ public string Plot { get; set; }
///
- /// Backing field for Tagline.
- ///
- protected string _Tagline;
- ///
- /// When provided in a partial class, allows value of Tagline to be changed before setting.
- ///
- partial void SetTagline(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Tagline to be changed before returning.
- ///
- partial void GetTagline(ref string result);
-
- ///
- /// Max length = 1024
- ///
- [MaxLength(1024)]
- [StringLength(1024)]
- public string Tagline
- {
- get
- {
- string value = _Tagline;
- GetTagline(ref value);
- return _Tagline = value;
- }
-
- set
- {
- string oldValue = _Tagline;
- SetTagline(oldValue, ref value);
- if (oldValue != value)
- {
- _Tagline = value;
- }
- }
- }
-
- ///
- /// Backing field for Country.
- ///
- protected string _Country;
- ///
- /// When provided in a partial class, allows value of Country to be changed before setting.
- ///
- partial void SetCountry(string oldValue, ref string newValue);
- ///
- /// When provided in a partial class, allows value of Country to be changed before returning.
- ///
- partial void GetCountry(ref string result);
-
- ///
- /// Max length = 2
+ /// Gets or sets the country code.
///
+ ///
+ /// Max length = 2.
+ ///
[MaxLength(2)]
[StringLength(2)]
- public string Country
- {
- get
- {
- string value = _Country;
- GetCountry(ref value);
- return _Country = value;
- }
+ public string Country { get; set; }
- set
- {
- string oldValue = _Country;
- SetCountry(oldValue, ref value);
- if (oldValue != value)
- {
- _Country = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
- [ForeignKey("Company_Studios_Id")]
+ ///
+ /// Gets or sets the studios that produced this movie.
+ ///
public virtual ICollection Studios { get; protected set; }
+
+ ///
+ [NotMapped]
+ public ICollection Companies => Studios;
}
}
-
diff --git a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
index 52776b12e6..2ed1f78c56 100644
--- a/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
+++ b/Jellyfin.Data/Entities/Libraries/MusicAlbum.cs
@@ -1,71 +1,29 @@
-#pragma warning disable CS1591
-
-using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class MusicAlbum : LibraryItem
+ ///
+ /// An entity representing a music album.
+ ///
+ public class MusicAlbum : LibraryItem
{
- partial void Init();
-
///
- /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// Initializes a new instance of the class.
///
- protected MusicAlbum()
+ public MusicAlbum()
{
MusicAlbumMetadata = new HashSet();
Tracks = new HashSet