aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2020-05-22 20:20:18 -0400
committerPatrick Barron <barronpm@gmail.com>2020-05-22 20:20:18 -0400
commit56212e8101ffadcef115a8fa41bae569094f069e (patch)
tree0ef330ec79ac9d47d7528517668d7013d27554a1
parent42177d173949ebc04810ad2ad9a432c42f7b0c69 (diff)
Warnings cleanup
-rw-r--r--Jellyfin.Data/Entities/AccessSchedule.cs48
-rw-r--r--Jellyfin.Data/Entities/Permission.cs104
-rw-r--r--Jellyfin.Server.Implementations/JellyfinDb.cs54
-rw-r--r--MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs1
4 files changed, 94 insertions, 113 deletions
diff --git a/Jellyfin.Data/Entities/AccessSchedule.cs b/Jellyfin.Data/Entities/AccessSchedule.cs
index 711e94dd1..4248a34c9 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 706128028..b675e911d 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();
}
}
-
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs
index 7e10d81dc..89fd371f8 100644
--- a/Jellyfin.Server.Implementations/JellyfinDb.cs
+++ b/Jellyfin.Server.Implementations/JellyfinDb.cs
@@ -1,9 +1,4 @@
#pragma warning disable CS1591
-#pragma warning disable SA1201 // Constuctors should not follow properties
-#pragma warning disable SA1516 // Elements should be followed by a blank line
-#pragma warning disable SA1623 // Property's documentation should begin with gets or sets
-#pragma warning disable SA1629 // Documentation should end with a period
-#pragma warning disable SA1648 // Inheritdoc should be used with inheriting class
using System.Linq;
using Jellyfin.Data;
@@ -15,6 +10,19 @@ namespace Jellyfin.Server.Implementations
/// <inheritdoc/>
public partial class JellyfinDb : DbContext
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JellyfinDb"/> class.
+ /// </summary>
+ /// <param name="options">The database context options.</param>
+ public JellyfinDb(DbContextOptions<JellyfinDb> options) : base(options)
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the default connection string.
+ /// </summary>
+ public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
+
public virtual DbSet<ActivityLog> ActivityLogs { get; set; }
public virtual DbSet<Group> Groups { get; set; }
@@ -69,17 +77,18 @@ namespace Jellyfin.Server.Implementations
public virtual DbSet<Track> Tracks { get; set; }
public virtual DbSet<TrackMetadata> TrackMetadata { get; set; }*/
- /// <summary>
- /// Gets or sets the default connection string.
- /// </summary>
- public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
-
- /// <inheritdoc />
- public JellyfinDb(DbContextOptions<JellyfinDb> options) : base(options)
+ /// <inheritdoc/>
+ public override int SaveChanges()
{
- }
+ foreach (var saveEntity in ChangeTracker.Entries()
+ .Where(e => e.State == EntityState.Modified)
+ .OfType<ISavingChanges>())
+ {
+ saveEntity.OnSavingChanges();
+ }
- partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
+ return base.SaveChanges();
+ }
/// <inheritdoc />
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
@@ -87,9 +96,6 @@ namespace Jellyfin.Server.Implementations
CustomInit(optionsBuilder);
}
- partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
- partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
-
/// <inheritdoc />
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -109,16 +115,10 @@ namespace Jellyfin.Server.Implementations
OnModelCreatedImpl(modelBuilder);
}
- public override int SaveChanges()
- {
- foreach (var saveEntity in ChangeTracker.Entries()
- .Where(e => e.State == EntityState.Modified)
- .OfType<ISavingChanges>())
- {
- saveEntity.OnSavingChanges();
- }
+ partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
- return base.SaveChanges();
- }
+ partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
+
+ partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
}
}
diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
index 9f505be93..df9050de5 100644
--- a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
+++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities;
-using User = Jellyfin.Data.Entities.User;
namespace MediaBrowser.Controller.Drawing
{