< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Libraries.PersonRole
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/PersonRole.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 7
Coverable lines: 7
Total lines: 80
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/PersonRole.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.ComponentModel.DataAnnotations;
 3using System.ComponentModel.DataAnnotations.Schema;
 4using Jellyfin.Data.Enums;
 5using Jellyfin.Data.Interfaces;
 6
 7namespace Jellyfin.Data.Entities.Libraries
 8{
 9    /// <summary>
 10    /// An entity representing a person's role in media.
 11    /// </summary>
 12    public class PersonRole : IHasArtwork, IHasConcurrencyToken
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="PersonRole"/> class.
 16        /// </summary>
 17        /// <param name="type">The role type.</param>
 18        /// <param name="person">The person.</param>
 19        public PersonRole(PersonRoleType type, Person person)
 20        {
 021            Type = type;
 022            Person = person;
 023            Artwork = new HashSet<Artwork>();
 024            Sources = new HashSet<MetadataProviderId>();
 025        }
 26
 27        /// <summary>
 28        /// Gets the id.
 29        /// </summary>
 30        /// <remarks>
 31        /// Identity, Indexed, Required.
 32        /// </remarks>
 33        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 34        public int Id { get; private set; }
 35
 36        /// <summary>
 37        /// Gets or sets the name of the person's role.
 38        /// </summary>
 39        /// <remarks>
 40        /// Max length = 1024.
 41        /// </remarks>
 42        [MaxLength(1024)]
 43        [StringLength(1024)]
 44        public string? Role { get; set; }
 45
 46        /// <summary>
 47        /// Gets or sets the person's role type.
 48        /// </summary>
 49        /// <remarks>
 50        /// Required.
 51        /// </remarks>
 52        public PersonRoleType Type { get; set; }
 53
 54        /// <inheritdoc />
 55        [ConcurrencyCheck]
 56        public uint RowVersion { get; private set; }
 57
 58        /// <summary>
 59        /// Gets or sets the person.
 60        /// </summary>
 61        /// <remarks>
 62        /// Required.
 63        /// </remarks>
 64        public virtual Person Person { get; set; }
 65
 66        /// <inheritdoc />
 67        public virtual ICollection<Artwork> Artwork { get; private set; }
 68
 69        /// <summary>
 70        /// Gets a collection containing the metadata sources for this person role.
 71        /// </summary>
 72        public virtual ICollection<MetadataProviderId> Sources { get; private set; }
 73
 74        /// <inheritdoc />
 75        public void OnSavingChanges()
 76        {
 077            RowVersion++;
 078        }
 79    }
 80}