< Summary - Jellyfin

Information
Class: Jellyfin.Server.Implementations.Extensions.ServiceCollectionExtensions
Assembly: Jellyfin.Server.Implementations
File(s): /srv/git/jellyfin/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 29
Line coverage: 100%
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
AddJellyfinDbContext(...)100%11100%

File(s)

/srv/git/jellyfin/Jellyfin.Server.Implementations/Extensions/ServiceCollectionExtensions.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3using MediaBrowser.Common.Configuration;
 4using Microsoft.EntityFrameworkCore;
 5using Microsoft.Extensions.DependencyInjection;
 6
 7namespace Jellyfin.Server.Implementations.Extensions;
 8
 9/// <summary>
 10/// Extensions for the <see cref="IServiceCollection"/> interface.
 11/// </summary>
 12public static class ServiceCollectionExtensions
 13{
 14    /// <summary>
 15    /// Adds the <see cref="IDbContextFactory{TContext}"/> interface to the service collection with second level caching
 16    /// </summary>
 17    /// <param name="serviceCollection">An instance of the <see cref="IServiceCollection"/> interface.</param>
 18    /// <returns>The updated service collection.</returns>
 19    public static IServiceCollection AddJellyfinDbContext(this IServiceCollection serviceCollection)
 20    {
 2221        serviceCollection.AddPooledDbContextFactory<JellyfinDbContext>((serviceProvider, opt) =>
 2222        {
 2223            var applicationPaths = serviceProvider.GetRequiredService<IApplicationPaths>();
 2224            opt.UseSqlite($"Filename={Path.Combine(applicationPaths.DataPath, "jellyfin.db")}");
 2225        });
 26
 2227        return serviceCollection;
 28    }
 29}