First pass at cleaning entity classes.

- Documents all library entities
- Fixes styling warnings for library entities
- Updates library entities to inherit from interfaces
- Makes library entites no longer partial.
This commit is contained in:
Patrick Barron
2020-08-30 18:50:54 -04:00
parent 414bedbde4
commit acb213e4b8
50 changed files with 1335 additions and 5213 deletions

View File

@@ -1,35 +1,19 @@
#pragma warning disable CS1591
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
public partial class MetadataProvider
/// <summary>
/// An entity representing a metadata provider.
/// </summary>
public class MetadataProvider : IHasConcurrencyToken
{
partial void Init();
/// <summary>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// Initializes a new instance of the <see cref="MetadataProvider"/> class.
/// </summary>
protected MetadataProvider()
{
Init();
}
/// <summary>
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving.
/// </summary>
public static MetadataProvider CreateMetadataProviderUnsafe()
{
return new MetadataProvider();
}
/// <summary>
/// Public constructor with required data.
/// </summary>
/// <param name="name"></param>
/// <param name="name">The name of the metadata provider.</param>
public MetadataProvider(string name)
{
if (string.IsNullOrEmpty(name))
@@ -37,117 +21,47 @@ namespace Jellyfin.Data.Entities.Libraries
throw new ArgumentNullException(nameof(name));
}
this.Name = name;
Init();
Name = name;
}
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// Initializes a new instance of the <see cref="MetadataProvider"/> class.
/// </summary>
/// <param name="name"></param>
public static MetadataProvider Create(string name)
/// <remarks>
/// Default constructor. Protected due to required properties, but present because EF needs it.
/// </remarks>
protected MetadataProvider()
{
return new MetadataProvider(name);
}
/*************************************************************************
* Properties
*************************************************************************/
/// <summary>
/// Backing field for Id.
/// Gets or sets the id.
/// </summary>
internal int _Id;
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before setting.
/// </summary>
partial void SetId(int oldValue, ref int newValue);
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before returning.
/// </summary>
partial void GetId(ref int result);
/// <summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </summary>
[Key]
[Required]
/// </remarks>
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id
{
get
{
int value = _Id;
GetId(ref value);
return _Id = value;
}
protected set
{
int oldValue = _Id;
SetId(oldValue, ref value);
if (oldValue != value)
{
_Id = value;
}
}
}
public int Id { get; protected set; }
/// <summary>
/// Backing field for Name.
/// </summary>
protected string _Name;
/// <summary>
/// When provided in a partial class, allows value of Name to be changed before setting.
/// </summary>
partial void SetName(string oldValue, ref string newValue);
/// <summary>
/// When provided in a partial class, allows value of Name to be changed before returning.
/// </summary>
partial void GetName(ref string result);
/// <summary>
/// Required, Max length = 1024
/// Gets or sets the name.
/// </summary>
/// <remarks>
/// Required, Max length = 1024.
/// </remarks>
[Required]
[MaxLength(1024)]
[StringLength(1024)]
public string Name
{
get
{
string value = _Name;
GetName(ref value);
return _Name = value;
}
public string Name { get; set; }
set
{
string oldValue = _Name;
SetName(oldValue, ref value);
if (oldValue != value)
{
_Name = value;
}
}
}
/// <summary>
/// Required, ConcurrenyToken.
/// </summary>
/// <inheritdoc />
[ConcurrencyCheck]
[Required]
public uint RowVersion { get; set; }
/// <inheritdoc />
public void OnSavingChanges()
{
RowVersion++;
}
/*************************************************************************
* Navigation properties
*************************************************************************/
}
}