BookMetadata.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 BookMetadata : Metadata
  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 BookMetadata()
  14. {
  15. Publishers = new HashSet<Company>();
  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 BookMetadata CreateBookMetadataUnsafe()
  22. {
  23. return new BookMetadata();
  24. }
  25. /// <summary>
  26. /// Public constructor with required data.
  27. /// </summary>
  28. /// <param name="title">The title or name of the object.</param>
  29. /// <param name="language">ISO-639-3 3-character language codes.</param>
  30. /// <param name="dateadded">The date the object was added.</param>
  31. /// <param name="datemodified">The date the object was last modified.</param>
  32. /// <param name="_book0"></param>
  33. public BookMetadata(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
  34. {
  35. if (string.IsNullOrEmpty(title))
  36. {
  37. throw new ArgumentNullException(nameof(title));
  38. }
  39. this.Title = title;
  40. if (string.IsNullOrEmpty(language))
  41. {
  42. throw new ArgumentNullException(nameof(language));
  43. }
  44. this.Language = language;
  45. if (_book0 == null)
  46. {
  47. throw new ArgumentNullException(nameof(_book0));
  48. }
  49. _book0.BookMetadata.Add(this);
  50. this.Publishers = new HashSet<Company>();
  51. Init();
  52. }
  53. /// <summary>
  54. /// Static create function (for use in LINQ queries, etc.)
  55. /// </summary>
  56. /// <param name="title">The title or name of the object.</param>
  57. /// <param name="language">ISO-639-3 3-character language codes.</param>
  58. /// <param name="dateadded">The date the object was added.</param>
  59. /// <param name="datemodified">The date the object was last modified.</param>
  60. /// <param name="_book0"></param>
  61. public static BookMetadata Create(string title, string language, DateTime dateadded, DateTime datemodified, Book _book0)
  62. {
  63. return new BookMetadata(title, language, dateadded, datemodified, _book0);
  64. }
  65. /*************************************************************************
  66. * Properties
  67. *************************************************************************/
  68. /// <summary>
  69. /// Backing field for ISBN.
  70. /// </summary>
  71. protected long? _ISBN;
  72. /// <summary>
  73. /// When provided in a partial class, allows value of ISBN to be changed before setting.
  74. /// </summary>
  75. partial void SetISBN(long? oldValue, ref long? newValue);
  76. /// <summary>
  77. /// When provided in a partial class, allows value of ISBN to be changed before returning.
  78. /// </summary>
  79. partial void GetISBN(ref long? result);
  80. public long? ISBN
  81. {
  82. get
  83. {
  84. long? value = _ISBN;
  85. GetISBN(ref value);
  86. return _ISBN = value;
  87. }
  88. set
  89. {
  90. long? oldValue = _ISBN;
  91. SetISBN(oldValue, ref value);
  92. if (oldValue != value)
  93. {
  94. _ISBN = value;
  95. }
  96. }
  97. }
  98. /*************************************************************************
  99. * Navigation properties
  100. *************************************************************************/
  101. [ForeignKey("Company_Publishers_Id")]
  102. public virtual ICollection<Company> Publishers { get; protected set; }
  103. }
  104. }