diff options
Diffstat (limited to 'Jellyfin.Data/Entities/Libraries/MetadataProvider.cs')
| -rw-r--r-- | Jellyfin.Data/Entities/Libraries/MetadataProvider.cs | 134 |
1 files changed, 24 insertions, 110 deletions
diff --git a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs index d5462113b..a18a612bc 100644 --- a/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs +++ b/Jellyfin.Data/Entities/Libraries/MetadataProvider.cs @@ -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. - /// </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. + /// Initializes a new instance of the <see cref="MetadataProvider"/> class. /// </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. - /// </summary> - internal int _Id; /// <summary> - /// When provided in a partial class, allows value of Id to be changed before setting. + /// Gets or sets the id. /// </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; - } - } - } - - /// <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); + public int Id { get; protected set; } /// <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 - *************************************************************************/ } } - |
