< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Libraries.ItemMetadata
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/ItemMetadata.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 141
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/ItemMetadata.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 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 sort title.
 67        /// </summary>
 68        /// <remarks>
 69        /// Max length = 1024.
 70        /// </remarks>
 71        [MaxLength(1024)]
 72        [StringLength(1024)]
 73        public string? SortTitle { get; set; }
 74
 75        /// <summary>
 76        /// Gets or sets the language.
 77        /// </summary>
 78        /// <remarks>
 79        /// Required, Min length = 3, Max length = 3.
 80        /// ISO-639-3 3-character language codes.
 81        /// </remarks>
 82        [MinLength(3)]
 83        [MaxLength(3)]
 84        [StringLength(3)]
 85        public string Language { get; set; }
 86
 87        /// <summary>
 88        /// Gets or sets the release date.
 89        /// </summary>
 90        public DateTimeOffset? ReleaseDate { get; set; }
 91
 92        /// <summary>
 93        /// Gets the date added.
 94        /// </summary>
 95        /// <remarks>
 96        /// Required.
 97        /// </remarks>
 98        public DateTime DateAdded { get; private set; }
 99
 100        /// <summary>
 101        /// Gets or sets the date modified.
 102        /// </summary>
 103        /// <remarks>
 104        /// Required.
 105        /// </remarks>
 106        public DateTime DateModified { get; set; }
 107
 108        /// <inheritdoc />
 109        [ConcurrencyCheck]
 110        public uint RowVersion { get; private set; }
 111
 112        /// <summary>
 113        /// Gets a collection containing the person roles for this item.
 114        /// </summary>
 115        public virtual ICollection<PersonRole> PersonRoles { get; private set; }
 116
 117        /// <summary>
 118        /// Gets a collection containing the genres for this item.
 119        /// </summary>
 120        public virtual ICollection<Genre> Genres { get; private set; }
 121
 122        /// <inheritdoc />
 123        public virtual ICollection<Artwork> Artwork { get; private set; }
 124
 125        /// <summary>
 126        /// Gets a collection containing the ratings for this item.
 127        /// </summary>
 128        public virtual ICollection<Rating> Ratings { get; private set; }
 129
 130        /// <summary>
 131        /// Gets a collection containing the metadata sources for this item.
 132        /// </summary>
 133        public virtual ICollection<MetadataProviderId> Sources { get; private set; }
 134
 135        /// <inheritdoc />
 136        public void OnSavingChanges()
 137        {
 0138            RowVersion++;
 0139        }
 140    }
 141}