BookMetadata.cs 3.8 KB

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