Book.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel.DataAnnotations.Schema;
  5. namespace Jellyfin.Data.Entities
  6. {
  7. public partial class Book : LibraryItem
  8. {
  9. partial void Init();
  10. /// <summary>
  11. /// Default constructor. Protected due to required properties, but present because EF needs it.
  12. /// </summary>
  13. protected Book()
  14. {
  15. BookMetadata = new HashSet<BookMetadata>();
  16. Releases = new HashSet<Release>();
  17. Init();
  18. }
  19. /// <summary>
  20. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  21. /// </summary>
  22. public static Book CreateBookUnsafe()
  23. {
  24. return new Book();
  25. }
  26. /// <summary>
  27. /// Public constructor with required data.
  28. /// </summary>
  29. /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
  30. /// <param name="dateadded">The date the object was added.</param>
  31. public Book(Guid urlid, DateTime dateadded)
  32. {
  33. this.UrlId = urlid;
  34. this.BookMetadata = new HashSet<BookMetadata>();
  35. this.Releases = new HashSet<Release>();
  36. Init();
  37. }
  38. /// <summary>
  39. /// Static create function (for use in LINQ queries, etc.)
  40. /// </summary>
  41. /// <param name="urlid">This is whats gets displayed in the Urls and API requests. This could also be a string.</param>
  42. /// <param name="dateadded">The date the object was added.</param>
  43. public static Book Create(Guid urlid, DateTime dateadded)
  44. {
  45. return new Book(urlid, dateadded);
  46. }
  47. /*************************************************************************
  48. * Properties
  49. *************************************************************************/
  50. /*************************************************************************
  51. * Navigation properties
  52. *************************************************************************/
  53. [ForeignKey("BookMetadata_BookMetadata_Id")]
  54. public virtual ICollection<BookMetadata> BookMetadata { get; protected set; }
  55. [ForeignKey("Release_Releases_Id")]
  56. public virtual ICollection<Release> Releases { get; protected set; }
  57. }
  58. }