Movie.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. namespace Jellyfin.Data.Entities
  5. {
  6. public partial class Movie : 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 Movie()
  13. {
  14. Releases = new HashSet<Release>();
  15. MovieMetadata = new HashSet<MovieMetadata>();
  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 Movie CreateMovieUnsafe()
  22. {
  23. return new Movie();
  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 Movie(Guid urlid, DateTime dateadded)
  30. {
  31. this.UrlId = urlid;
  32. this.Releases = new HashSet<Release>();
  33. this.MovieMetadata = new HashSet<MovieMetadata>();
  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 Movie Create(Guid urlid, DateTime dateadded)
  41. {
  42. return new Movie(urlid, dateadded);
  43. }
  44. /*************************************************************************
  45. * Properties
  46. *************************************************************************/
  47. /*************************************************************************
  48. * Navigation properties
  49. *************************************************************************/
  50. [ForeignKey("Release_Releases_Id")]
  51. public virtual ICollection<Release> Releases { get; protected set; }
  52. [ForeignKey("MovieMetadata_MovieMetadata_Id")]
  53. public virtual ICollection<MovieMetadata> MovieMetadata { get; protected set; }
  54. }
  55. }