Book.cs 2.3 KB

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