aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Data/Entities/Libraries/BookMetadata.cs')
-rw-r--r--Jellyfin.Data/Entities/Libraries/BookMetadata.cs120
1 files changed, 25 insertions, 95 deletions
diff --git a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
index 91eecbbf9..bd716712b 100644
--- a/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
+++ b/Jellyfin.Data/Entities/Libraries/BookMetadata.cs
@@ -1,125 +1,55 @@
-#pragma warning disable CS1591
-
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
+using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
- public partial class BookMetadata : Metadata
+ /// <summary>
+ /// An entity containing metadata for a book.
+ /// </summary>
+ public class BookMetadata : Metadata, IHasCompanies
{
- partial void Init();
-
- /// <summary>
- /// Default constructor. Protected due to required properties, but present because EF needs it.
- /// </summary>
- protected BookMetadata()
- {
- Publishers = new HashSet<Company>();
-
- Init();
- }
-
/// <summary>
- /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
- /// </summary>
- public static BookMetadata CreateBookMetadataUnsafe()
- {
- return new BookMetadata();
- }
-
- /// <summary>
- /// Public constructor with required data.
+ /// Initializes a new instance of the <see cref="BookMetadata"/> class.
/// </summary>
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_book0"></param>
- public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
+ /// <param name="book">The book.</param>
+ public BookMetadata(string title, string language, Book book) : base(title, language)
{
- if (string.IsNullOrEmpty(title))
- {
- throw new ArgumentNullException(nameof(title));
- }
-
- this.Title = title;
-
- if (string.IsNullOrEmpty(language))
- {
- throw new ArgumentNullException(nameof(language));
- }
-
- this.Language = language;
-
- if (_book0 == null)
+ if (book == null)
{
- throw new ArgumentNullException(nameof(_book0));
+ throw new ArgumentNullException(nameof(book));
}
- _book0.BookMetadata.Add(this);
-
- this.Publishers = new HashSet<Company>();
+ book.BookMetadata.Add(this);
- Init();
+ Publishers = new HashSet<Company>();
}
/// <summary>
- /// Static create function (for use in LINQ queries, etc.)
+ /// Initializes a new instance of the <see cref="BookMetadata"/> class.
/// </summary>
- /// <param name="title">The title or name of the object.</param>
- /// <param name="language">ISO-639-3 3-character language codes.</param>
- /// <param name="dateadded">The date the object was added.</param>
- /// <param name="datemodified">The date the object was last modified.</param>
- /// <param name="_book0"></param>
- public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
+ /// <remarks>
+ /// Default constructor. Protected due to required properties, but present because EF needs it.
+ /// </remarks>
+ protected BookMetadata()
{
- return new BookMetadata(title, language, dateadded, datemodified, _book0);
}
- /*************************************************************************
- * Properties
- *************************************************************************/
-
- /// <summary>
- /// Backing field for ISBN.
- /// </summary>
- protected long? _ISBN;
/// <summary>
- /// When provided in a partial class, allows value of ISBN to be changed before setting.
+ /// Gets or sets the ISBN.
/// </summary>
- partial void SetISBN(long? oldValue, ref long? newValue);
+ public long? Isbn { get; set; }
+
/// <summary>
- /// When provided in a partial class, allows value of ISBN to be changed before returning.
+ /// Gets or sets a collection of the publishers for this book.
/// </summary>
- partial void GetISBN(ref long? result);
-
- public long? ISBN
- {
- get
- {
- long? value = _ISBN;
- GetISBN(ref value);
- return _ISBN = value;
- }
-
- set
- {
- long? oldValue = _ISBN;
- SetISBN(oldValue, ref value);
- if (oldValue != value)
- {
- _ISBN = value;
- }
- }
- }
-
- /*************************************************************************
- * Navigation properties
- *************************************************************************/
-
- [ForeignKey("Company_Publishers_Id")]
public virtual ICollection<Company> Publishers { get; protected set; }
+
+ /// <inheritdoc />
+ [NotMapped]
+ public ICollection<Company> Companies => Publishers;
}
}
-