• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

net-daemon / netdaemon / 17531059938

07 Sep 2025 04:27PM UTC coverage: 83.948% (-0.1%) from 84.091%
17531059938

Pull #1326

github

web-flow
Merge c5324367d into 25a52e371
Pull Request #1326: Support for Delegate style minimal Apps

858 of 1147 branches covered (74.8%)

Branch coverage included in aggregate %.

40 of 43 new or added lines in 10 files covered. (93.02%)

3 existing lines in 1 file now uncovered.

3352 of 3868 relevant lines covered (86.66%)

998.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/src/HassModel/NetDaemon.HassModel/DependencyInjectionSetup.cs
1
using Microsoft.Extensions.Hosting;
2

3
namespace NetDaemon.HassModel;
4

5
/// <summary>
6
/// Setup methods for services configuration
7
/// </summary>
8
public static class DependencyInjectionSetup
9
{
10
    /// <summary>
11
    /// Registers services for using the IHaContext interface scoped to NetDaemonApps
12
    /// </summary>
13
    public static IHostBuilder UseAppScopedHaContext(this IHostBuilder hostBuilder)
14
    {
15

UNCOV
16
        ArgumentNullException.ThrowIfNull(hostBuilder, nameof(hostBuilder));
×
17

UNCOV
18
        return hostBuilder
×
UNCOV
19
            .ConfigureServices((_, services) => services.AddScopedHaContext());
×
20
    }
21

22
    /// <summary>
23
    /// Registers services for using the IHaContext interface scoped to NetDaemonApps
24
    /// </summary>
25
    public static void AddScopedHaContext(this IServiceCollection services)
26
    {
27
        services.AddSingleton<EntityStateCache>();
36✔
28
        services.AddSingleton<RegistryCache>();
36✔
29
        services.AddScoped<HaRegistry>();
36✔
30

31
        services.AddScoped<AppScopedHaContextProvider>();
36✔
32
        services.AddScoped<IHaRegistry>(sp => sp.GetRequiredService<AppScopedHaContextProvider>().Registry);
36✔
33
        services.AddScoped<IHaRegistryNavigator>(sp => sp.GetRequiredService<AppScopedHaContextProvider>().Registry);
36✔
34
        services.AddScoped<BackgroundTaskTracker>();
36✔
35
        services.AddScoped<IBackgroundTaskTracker>(s => s.GetRequiredService<BackgroundTaskTracker>());
65✔
36
        services.AddTransient<ICacheManager, CacheManager>();
36✔
37
        services.AddTransient<IHaContext>(s => s.GetRequiredService<AppScopedHaContextProvider>());
76✔
38
        services.AddScoped<TriggerManager>();
36✔
39
        services.AddTransient<ITriggerManager>(s => s.GetRequiredService<TriggerManager>());
39✔
40
        services.AddTransient<IEntityFactory, DefaultEntityFactory>();
36✔
41
    }
36✔
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc