< Summary

Information
Class: TeleFlow.Framework.DependencyInjection.ApplicationLifecycleServiceCollectionExtensions
Assembly: TeleFlow.Framework.Core
File(s): /_/src/TeleFlow.Framework.Core/DependencyInjection/ApplicationLifecycleServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 35
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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddTeleFlowStartupTask(...)100%11100%
AddTeleFlowShutdownTask(...)100%11100%

File(s)

/_/src/TeleFlow.Framework.Core/DependencyInjection/ApplicationLifecycleServiceCollectionExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2using TeleFlow.Framework.Application;
 3
 4namespace TeleFlow.Framework.DependencyInjection;
 5
 6/// <summary>
 7/// Registers TeleFlow application lifecycle tasks that execute before and after update source processing.
 8/// These registration APIs store task types so the runtime can create each task from the correct lifecycle scope.
 9/// </summary>
 10public static class ApplicationLifecycleServiceCollectionExtensions
 11{
 12    /// <summary>
 13    /// Registers a startup task that runs before the configured update source starts processing updates.
 14    /// </summary>
 15    public static IServiceCollection AddTeleFlowStartupTask<TTask>(this IServiceCollection services)
 16        where TTask : class, ITeleFlowStartupTask
 17    {
 718        ArgumentNullException.ThrowIfNull(services);
 19
 720        services.AddSingleton(new TeleFlowStartupTaskRegistration(typeof(TTask)));
 721        return services;
 22    }
 23
 24    /// <summary>
 25    /// Registers a shutdown task that runs after the configured update source stops processing updates.
 26    /// </summary>
 27    public static IServiceCollection AddTeleFlowShutdownTask<TTask>(this IServiceCollection services)
 28        where TTask : class, ITeleFlowShutdownTask
 29    {
 830        ArgumentNullException.ThrowIfNull(services);
 31
 832        services.AddSingleton(new TeleFlowShutdownTaskRegistration(typeof(TTask)));
 833        return services;
 34    }
 35}