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

net-daemon / netdaemon / 17477775006

04 Sep 2025 10:02PM UTC coverage: 83.95% (-0.1%) from 84.091%
17477775006

Pull #1326

github

web-flow
Merge c789af775 into 25a52e371
Pull Request #1326: Initial version of Func style Apps

859 of 1145 branches covered (75.02%)

Branch coverage included in aggregate %.

17 of 22 new or added lines in 4 files covered. (77.27%)

4 existing lines in 2 files now uncovered.

3362 of 3883 relevant lines covered (86.58%)

534.98 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