Permission.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated from a template.
  4. //
  5. // Manual changes to this file may cause unexpected behavior in your application.
  6. // Manual changes to this file will be overwritten if the code is regenerated.
  7. //
  8. // Produced by Entity Framework Visual Editor
  9. // https://github.com/msawczyn/EFDesigner
  10. // </auto-generated>
  11. //------------------------------------------------------------------------------
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Collections.ObjectModel;
  15. using System.ComponentModel;
  16. using System.ComponentModel.DataAnnotations;
  17. using System.ComponentModel.DataAnnotations.Schema;
  18. using System.Linq;
  19. using System.Runtime.CompilerServices;
  20. namespace Jellyfin.Data.Entities
  21. {
  22. public partial class Permission
  23. {
  24. partial void Init();
  25. /// <summary>
  26. /// Default constructor. Protected due to required properties, but present because EF needs it.
  27. /// </summary>
  28. protected Permission()
  29. {
  30. Init();
  31. }
  32. /// <summary>
  33. /// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
  34. /// </summary>
  35. public static Permission CreatePermissionUnsafe()
  36. {
  37. return new Permission();
  38. }
  39. /// <summary>
  40. /// Public constructor with required data
  41. /// </summary>
  42. /// <param name="kind"></param>
  43. /// <param name="value"></param>
  44. /// <param name="_user0"></param>
  45. /// <param name="_group1"></param>
  46. public Permission(global::Jellyfin.Data.Enums.PermissionKind kind, bool value, global::Jellyfin.Data.Entities.User _user0, global::Jellyfin.Data.Entities.Group _group1)
  47. {
  48. this.Kind = kind;
  49. this.Value = value;
  50. if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
  51. _user0.Permissions.Add(this);
  52. if (_group1 == null) throw new ArgumentNullException(nameof(_group1));
  53. _group1.GroupPermissions.Add(this);
  54. Init();
  55. }
  56. /// <summary>
  57. /// Static create function (for use in LINQ queries, etc.)
  58. /// </summary>
  59. /// <param name="kind"></param>
  60. /// <param name="value"></param>
  61. /// <param name="_user0"></param>
  62. /// <param name="_group1"></param>
  63. public static Permission Create(global::Jellyfin.Data.Enums.PermissionKind kind, bool value, global::Jellyfin.Data.Entities.User _user0, global::Jellyfin.Data.Entities.Group _group1)
  64. {
  65. return new Permission(kind, value, _user0, _group1);
  66. }
  67. /*************************************************************************
  68. * Properties
  69. *************************************************************************/
  70. /// <summary>
  71. /// Identity, Indexed, Required
  72. /// </summary>
  73. [Key]
  74. [Required]
  75. public int Id { get; protected set; }
  76. /// <summary>
  77. /// Backing field for Kind
  78. /// </summary>
  79. protected global::Jellyfin.Data.Enums.PermissionKind _Kind;
  80. /// <summary>
  81. /// When provided in a partial class, allows value of Kind to be changed before setting.
  82. /// </summary>
  83. partial void SetKind(global::Jellyfin.Data.Enums.PermissionKind oldValue, ref global::Jellyfin.Data.Enums.PermissionKind newValue);
  84. /// <summary>
  85. /// When provided in a partial class, allows value of Kind to be changed before returning.
  86. /// </summary>
  87. partial void GetKind(ref global::Jellyfin.Data.Enums.PermissionKind result);
  88. /// <summary>
  89. /// Required
  90. /// </summary>
  91. [Required]
  92. public global::Jellyfin.Data.Enums.PermissionKind Kind
  93. {
  94. get
  95. {
  96. global::Jellyfin.Data.Enums.PermissionKind value = _Kind;
  97. GetKind(ref value);
  98. return (_Kind = value);
  99. }
  100. set
  101. {
  102. global::Jellyfin.Data.Enums.PermissionKind oldValue = _Kind;
  103. SetKind(oldValue, ref value);
  104. if (oldValue != value)
  105. {
  106. _Kind = value;
  107. OnPropertyChanged();
  108. }
  109. }
  110. }
  111. /// <summary>
  112. /// Required
  113. /// </summary>
  114. [Required]
  115. public bool Value { get; set; }
  116. /// <summary>
  117. /// Concurrency token
  118. /// </summary>
  119. [Timestamp]
  120. public Byte[] Timestamp { get; set; }
  121. /*************************************************************************
  122. * Navigation properties
  123. *************************************************************************/
  124. public virtual event PropertyChangedEventHandler PropertyChanged;
  125. protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
  126. {
  127. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  128. }
  129. }
  130. }