diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-05-22 20:20:18 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-05-22 20:20:18 -0400 |
| commit | 56212e8101ffadcef115a8fa41bae569094f069e (patch) | |
| tree | 0ef330ec79ac9d47d7528517668d7013d27554a1 /Jellyfin.Data/Entities | |
| parent | 42177d173949ebc04810ad2ad9a432c42f7b0c69 (diff) | |
Warnings cleanup
Diffstat (limited to 'Jellyfin.Data/Entities')
| -rw-r--r-- | Jellyfin.Data/Entities/AccessSchedule.cs | 48 | ||||
| -rw-r--r-- | Jellyfin.Data/Entities/Permission.cs | 104 |
2 files changed, 67 insertions, 85 deletions
diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs index 711e94dd18..4248a34c9c 100644 --- a/Jellyfin.Data/Entities/AccessSchedule.cs +++ b/Jellyfin.Data/Entities/AccessSchedule.cs @@ -6,22 +6,18 @@ using Jellyfin.Data.Enums; namespace Jellyfin.Data.Entities { + /// <summary> + /// An entity representing a user's access schedule. + /// </summary> public class AccessSchedule { /// <summary> /// Initializes a new instance of the <see cref="AccessSchedule"/> class. - /// Default constructor. Protected due to required properties, but present because EF needs it. - /// </summary> - protected AccessSchedule() - { - } - - /// <summary> - /// Initializes a new instance of the <see cref="AccessSchedule"/> class. /// </summary> /// <param name="dayOfWeek">The day of the week.</param> /// <param name="startHour">The start hour.</param> /// <param name="endHour">The end hour.</param> + /// <param name="userId">The associated user's id.</param> public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId) { UserId = userId; @@ -31,26 +27,31 @@ namespace Jellyfin.Data.Entities } /// <summary> - /// Factory method + /// Initializes a new instance of the <see cref="AccessSchedule"/> class. + /// Default constructor. Protected due to required properties, but present because EF needs it. /// </summary> - /// <param name="dayOfWeek">The day of the week.</param> - /// <param name="startHour">The start hour.</param> - /// <param name="endHour">The end hour.</param> - /// <returns>The newly created instance.</returns> - public static AccessSchedule CreateInstance(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId) + protected AccessSchedule() { - return new AccessSchedule(dayOfWeek, startHour, endHour, userId); } + /// <summary> + /// Gets or sets the id of this instance. + /// </summary> + /// <remarks> + /// Identity, Indexed, Required. + /// </remarks> [JsonIgnore] [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } + public int Id { get; protected set; } + /// <summary> + /// Gets or sets the id of the associated user. + /// </summary> [Required] [ForeignKey("Id")] - public Guid UserId { get; set; } + public Guid UserId { get; protected set; } /// <summary> /// Gets or sets the day of week. @@ -72,5 +73,18 @@ namespace Jellyfin.Data.Entities /// <value>The end hour.</value> [Required] public double EndHour { get; set; } + + /// <summary> + /// Static create function (for use in LINQ queries, etc.) + /// </summary> + /// <param name="dayOfWeek">The day of the week.</param> + /// <param name="startHour">The start hour.</param> + /// <param name="endHour">The end hour.</param> + /// <param name="userId">The associated user's id.</param> + /// <returns>The newly created instance.</returns> + public static AccessSchedule Create(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId) + { + return new AccessSchedule(dayOfWeek, startHour, endHour, userId); + } } } diff --git a/Jellyfin.Data/Entities/Permission.cs b/Jellyfin.Data/Entities/Permission.cs index 7061280283..b675e911d9 100644 --- a/Jellyfin.Data/Entities/Permission.cs +++ b/Jellyfin.Data/Entities/Permission.cs @@ -1,23 +1,20 @@ -using System; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Runtime.CompilerServices; using Jellyfin.Data.Enums; namespace Jellyfin.Data.Entities { + /// <summary> + /// An entity representing whether the associated user has a specific permission. + /// </summary> public partial class Permission : ISavingChanges { - partial void Init(); - /// <summary> /// Initializes a new instance of the <see cref="Permission"/> class. - /// Public constructor with required data + /// Public constructor with required data. /// </summary> - /// <param name="kind"></param> - /// <param name="value"></param> - /// <param name="holderId"></param> + /// <param name="kind">The permission kind.</param> + /// <param name="value">The value of this permission.</param> public Permission(PermissionKind kind, bool value) { Kind = kind; @@ -35,95 +32,66 @@ namespace Jellyfin.Data.Entities Init(); } - /// <summary> - /// Static create function (for use in LINQ queries, etc.) - /// </summary> - /// <param name="kind"></param> - /// <param name="value"></param> - /// <param name="holderId"></param> - public static Permission Create(PermissionKind kind, bool value) - { - return new Permission(kind, value); - } - /************************************************************************* * Properties *************************************************************************/ /// <summary> - /// Identity, Indexed, Required + /// Gets or sets the id of this permission. /// </summary> + /// <remarks> + /// Identity, Indexed, Required. + /// </remarks> [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; protected set; } /// <summary> - /// Backing field for Kind - /// </summary> - protected PermissionKind _Kind; - /// <summary> - /// When provided in a partial class, allows value of Kind to be changed before setting. - /// </summary> - partial void SetKind(PermissionKind oldValue, ref PermissionKind newValue); - /// <summary> - /// When provided in a partial class, allows value of Kind to be changed before returning. - /// </summary> - partial void GetKind(ref PermissionKind result); - - /// <summary> - /// Required + /// Gets or sets the type of this permission. /// </summary> + /// <remarks> + /// Required. + /// </remarks> [Required] - public PermissionKind Kind - { - get - { - PermissionKind value = _Kind; - GetKind(ref value); - return _Kind = value; - } - - set - { - PermissionKind oldValue = _Kind; - SetKind(oldValue, ref value); - if (oldValue != value) - { - _Kind = value; - OnPropertyChanged(); - } - } - } + public PermissionKind Kind { get; protected set; } /// <summary> - /// Required + /// Gets or sets a value indicating whether the associated user has this permission. /// </summary> + /// <remarks> + /// Required. + /// </remarks> [Required] public bool Value { get; set; } /// <summary> - /// Required, ConcurrencyToken. + /// Gets or sets the row version. /// </summary> + /// <remarks> + /// Required, ConcurrencyToken. + /// </remarks> [ConcurrencyCheck] [Required] public uint RowVersion { get; set; } - public void OnSavingChanges() + /// <summary> + /// Static create function (for use in LINQ queries, etc.) + /// </summary> + /// <param name="kind">The permission kind.</param> + /// <param name="value">The value of this permission.</param> + /// <returns>The newly created instance.</returns> + public static Permission Create(PermissionKind kind, bool value) { - RowVersion++; + return new Permission(kind, value); } - /************************************************************************* - * Navigation properties - *************************************************************************/ - - public virtual event PropertyChangedEventHandler PropertyChanged; - - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + /// <inheritdoc/> + public void OnSavingChanges() { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + RowVersion++; } + + partial void Init(); } } - |
