ProviderMapping.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. namespace Jellyfin.Data.Entities
  5. {
  6. public partial class ProviderMapping
  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 ProviderMapping()
  13. {
  14. Init();
  15. }
  16. /// <summary>
  17. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  18. /// </summary>
  19. public static ProviderMapping CreateProviderMappingUnsafe()
  20. {
  21. return new ProviderMapping();
  22. }
  23. /// <summary>
  24. /// Public constructor with required data
  25. /// </summary>
  26. /// <param name="providername"></param>
  27. /// <param name="providersecrets"></param>
  28. /// <param name="providerdata"></param>
  29. /// <param name="_user0"></param>
  30. /// <param name="_group1"></param>
  31. public ProviderMapping(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
  32. {
  33. if (string.IsNullOrEmpty(providername)) throw new ArgumentNullException(nameof(providername));
  34. this.ProviderName = providername;
  35. if (string.IsNullOrEmpty(providersecrets)) throw new ArgumentNullException(nameof(providersecrets));
  36. this.ProviderSecrets = providersecrets;
  37. if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata));
  38. this.ProviderData = providerdata;
  39. Init();
  40. }
  41. /// <summary>
  42. /// Static create function (for use in LINQ queries, etc.)
  43. /// </summary>
  44. /// <param name="providername"></param>
  45. /// <param name="providersecrets"></param>
  46. /// <param name="providerdata"></param>
  47. /// <param name="_user0"></param>
  48. /// <param name="_group1"></param>
  49. public static ProviderMapping Create(string providername, string providersecrets, string providerdata, User _user0, Group _group1)
  50. {
  51. return new ProviderMapping(providername, providersecrets, providerdata, _user0, _group1);
  52. }
  53. /*************************************************************************
  54. * Properties
  55. *************************************************************************/
  56. /// <summary>
  57. /// Identity, Indexed, Required
  58. /// </summary>
  59. [Key]
  60. [Required]
  61. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  62. public int Id { get; protected set; }
  63. /// <summary>
  64. /// Required, Max length = 255
  65. /// </summary>
  66. [Required]
  67. [MaxLength(255)]
  68. [StringLength(255)]
  69. public string ProviderName { get; set; }
  70. /// <summary>
  71. /// Required, Max length = 65535
  72. /// </summary>
  73. [Required]
  74. [MaxLength(65535)]
  75. [StringLength(65535)]
  76. public string ProviderSecrets { get; set; }
  77. /// <summary>
  78. /// Required, Max length = 65535
  79. /// </summary>
  80. [Required]
  81. [MaxLength(65535)]
  82. [StringLength(65535)]
  83. public string ProviderData { get; set; }
  84. /// <summary>
  85. /// Required, ConcurrenyToken
  86. /// </summary>
  87. [ConcurrencyCheck]
  88. [Required]
  89. public uint RowVersion { get; set; }
  90. public void OnSavingChanges()
  91. {
  92. RowVersion++;
  93. }
  94. /*************************************************************************
  95. * Navigation properties
  96. *************************************************************************/
  97. }
  98. }