< Summary - Jellyfin

Information
Class: Jellyfin.Database.Implementations.Entities.Libraries.ItemMetadata
Assembly: Jellyfin.Database.Implementations
File(s): /srv/git/jellyfin/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 151
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 2/13/2026 - 12:11:21 AM Line coverage: 0% (0/14) Total lines: 1415/8/2026 - 12:15:13 AM Line coverage: 0% (0/14) Total lines: 151

Coverage delta

Coverage delta 1 -1

Metrics

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

File(s)

/srv/git/jellyfin/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/Libraries/ItemMetadata.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel.DataAnnotations;
 4using System.ComponentModel.DataAnnotations.Schema;
 5using Jellyfin.Database.Implementations.Interfaces;
 6
 7namespace Jellyfin.Database.Implementations.Entities.Libraries
 8{
 9    /// <summary>
 10    /// An abstract class that holds metadata.
 11    /// </summary>
 12    public abstract class ItemMetadata : IHasArtwork, IHasConcurrencyToken
 13    {
 14        /// <summary>
 15        /// Initializes a new instance of the <see cref="ItemMetadata"/> class.
 16        /// </summary>
 17        /// <param name="title">The title or name of the object.</param>
 18        /// <param name="language">ISO-639-3 3-character language codes.</param>
 19        protected ItemMetadata(string title, string language)
 20        {
 021            ArgumentException.ThrowIfNullOrEmpty(title);
 022            ArgumentException.ThrowIfNullOrEmpty(language);
 23
 024            Title = title;
 025            Language = language;
 026            DateAdded = DateTime.UtcNow;
 027            DateModified = DateAdded;
 28
 029            PersonRoles = new HashSet<PersonRole>();
 030            Genres = new HashSet<Genre>();
 031            Artwork = new HashSet<Artwork>();
 032            Ratings = new HashSet<Rating>();
 033            Sources = new HashSet<MetadataProviderId>();
 034        }
 35
 36        /// <summary>
 37        /// Gets the id.
 38        /// </summary>
 39        /// <remarks>
 40        /// Identity, Indexed, Required.
 41        /// </remarks>
 42        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 43        public int Id { get; private set; }
 44
 45        /// <summary>
 46        /// Gets or sets the title.
 47        /// </summary>
 48        /// <remarks>
 49        /// Required, Max length = 1024.
 50        /// </remarks>
 51        [MaxLength(1024)]
 52        [StringLength(1024)]
 53        public string Title { get; set; }
 54
 55        /// <summary>
 56        /// Gets or sets the original title.
 57        /// </summary>
 58        /// <remarks>
 59        /// Max length = 1024.
 60        /// </remarks>
 61        [MaxLength(1024)]
 62        [StringLength(1024)]
 63        public string? OriginalTitle { get; set; }
 64
 65        /// <summary>
 66        /// Gets or sets the original language.
 67        /// </summary>
 68        /// <remarks>
 69        /// Max length = 1024.
 70        /// </remarks>
 71        [MaxLength(1024)]
 72        [StringLength(1024)]
 73        public string? OriginalLanguage { get; set; }
 74
 75        /// <summary>
 76        /// Gets or sets the sort title.
 77        /// </summary>
 78        /// <remarks>
 79        /// Max length = 1024.
 80        /// </remarks>
 81        [MaxLength(1024)]
 82        [StringLength(1024)]
 83        public string? SortTitle { get; set; }
 84
 85        /// <summary>
 86        /// Gets or sets the language.
 87        /// </summary>
 88        /// <remarks>
 89        /// Required, Min length = 3, Max length = 3.
 90        /// ISO-639-3 3-character language codes.
 91        /// </remarks>
 92        [MinLength(3)]
 93        [MaxLength(3)]
 94        [StringLength(3)]
 95        public string Language { get; set; }
 96
 97        /// <summary>
 98        /// Gets or sets the release date.
 99        /// </summary>
 100        public DateTimeOffset? ReleaseDate { get; set; }
 101
 102        /// <summary>
 103        /// Gets the date added.
 104        /// </summary>
 105        /// <remarks>
 106        /// Required.
 107        /// </remarks>
 108        public DateTime DateAdded { get; private set; }
 109
 110        /// <summary>
 111        /// Gets or sets the date modified.
 112        /// </summary>
 113        /// <remarks>
 114        /// Required.
 115        /// </remarks>
 116        public DateTime DateModified { get; set; }
 117
 118        /// <inheritdoc />
 119        [ConcurrencyCheck]
 120        public uint RowVersion { get; private set; }
 121
 122        /// <summary>
 123        /// Gets a collection containing the person roles for this item.
 124        /// </summary>
 125        public virtual ICollection<PersonRole> PersonRoles { get; private set; }
 126
 127        /// <summary>
 128        /// Gets a collection containing the genres for this item.
 129        /// </summary>
 130        public virtual ICollection<Genre> Genres { get; private set; }
 131
 132        /// <inheritdoc />
 133        public virtual ICollection<Artwork> Artwork { get; private set; }
 134
 135        /// <summary>
 136        /// Gets a collection containing the ratings for this item.
 137        /// </summary>
 138        public virtual ICollection<Rating> Ratings { get; private set; }
 139
 140        /// <summary>
 141        /// Gets a collection containing the metadata sources for this item.
 142        /// </summary>
 143        public virtual ICollection<MetadataProviderId> Sources { get; private set; }
 144
 145        /// <inheritdoc />
 146        public void OnSavingChanges()
 147        {
 0148            RowVersion++;
 0149        }
 150    }
 151}