jellyfin/Jellyfin.Data/Entities/Libraries/BookMetadata.cs

58 lines
1.7 KiB
C#
Raw Normal View History

2020-09-01 15:36:45 +00:00
#pragma warning disable CA2227
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
2020-08-29 17:30:09 +00:00
namespace Jellyfin.Data.Entities.Libraries
{
/// <summary>
/// An entity containing metadata for a book.
/// </summary>
public class BookMetadata : Metadata, IHasCompanies
2020-05-02 21:56:05 +00:00
{
/// <summary>
/// Initializes a new instance of the <see cref="BookMetadata"/> class.
2020-05-02 21:56:05 +00:00
/// </summary>
2020-06-19 10:21:49 +00:00
/// <param name="title">The title or name of the object.</param>
/// <param name="language">ISO-639-3 3-character language codes.</param>
/// <param name="book">The book.</param>
public BookMetadata(string title, string language, Book book) : base(title, language)
2020-05-02 21:56:05 +00:00
{
if (book == null)
2020-06-20 08:35:29 +00:00
{
throw new ArgumentNullException(nameof(book));
2020-06-20 08:35:29 +00:00
}
book.BookMetadata.Add(this);
2020-05-02 21:56:05 +00:00
Publishers = new HashSet<Company>();
2020-05-02 21:56:05 +00:00
}
/// <summary>
/// Initializes a new instance of the <see cref="BookMetadata"/> class.
2020-05-02 21:56:05 +00:00
/// </summary>
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected BookMetadata()
2020-05-02 21:56:05 +00:00
{
}
/// <summary>
/// Gets or sets the ISBN.
2020-05-02 21:56:05 +00:00
/// </summary>
public long? Isbn { get; set; }
2020-05-02 21:56:05 +00:00
/// <summary>
/// Gets or sets a collection of the publishers for this book.
2020-05-02 21:56:05 +00:00
/// </summary>
public virtual ICollection<Company> Publishers { get; protected set; }
/// <inheritdoc />
[NotMapped]
public ICollection<Company> Companies => Publishers;
2020-05-02 21:56:05 +00:00
}
}