< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Libraries.Person
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/Person.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 89
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/Person.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel.DataAnnotations;
 4using System.ComponentModel.DataAnnotations.Schema;
 5using Jellyfin.Data.Interfaces;
 6
 7namespace Jellyfin.Data.Entities.Libraries
 8{
 9    /// <summary>
 10    /// An entity representing a person.
 11    /// </summary>
 12    public class Person : IHasConcurrencyToken
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="Person"/> class.
 16        /// </summary>
 17        /// <param name="name">The name of the person.</param>
 18        public Person(string name)
 19        {
 020            ArgumentException.ThrowIfNullOrEmpty(name);
 21
 022            Name = name;
 023            DateAdded = DateTime.UtcNow;
 024            DateModified = DateAdded;
 25
 026            Sources = new HashSet<MetadataProviderId>();
 027        }
 28
 29        /// <summary>
 30        /// Gets the id.
 31        /// </summary>
 32        /// <remarks>
 33        /// Identity, Indexed, Required.
 34        /// </remarks>
 35        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 36        public int Id { get; private set; }
 37
 38        /// <summary>
 39        /// Gets or sets the name.
 40        /// </summary>
 41        /// <remarks>
 42        /// Required, Max length = 1024.
 43        /// </remarks>
 44        [MaxLength(1024)]
 45        [StringLength(1024)]
 46        public string Name { get; set; }
 47
 48        /// <summary>
 49        /// Gets or sets the source id.
 50        /// </summary>
 51        /// <remarks>
 52        /// Max length = 255.
 53        /// </remarks>
 54        [MaxLength(256)]
 55        [StringLength(256)]
 56        public string? SourceId { get; set; }
 57
 58        /// <summary>
 59        /// Gets the date added.
 60        /// </summary>
 61        /// <remarks>
 62        /// Required.
 63        /// </remarks>
 64        public DateTime DateAdded { get; private set; }
 65
 66        /// <summary>
 67        /// Gets or sets the date modified.
 68        /// </summary>
 69        /// <remarks>
 70        /// Required.
 71        /// </remarks>
 72        public DateTime DateModified { get; set; }
 73
 74        /// <inheritdoc />
 75        [ConcurrencyCheck]
 76        public uint RowVersion { get; private set; }
 77
 78        /// <summary>
 79        /// Gets a list of metadata sources for this person.
 80        /// </summary>
 81        public virtual ICollection<MetadataProviderId> Sources { get; private set; }
 82
 83        /// <inheritdoc />
 84        public void OnSavingChanges()
 85        {
 086            RowVersion++;
 087        }
 88    }
 89}