77458383d1
- Expand inline guard, return and logger blocks across the monitor services, init classes and tests - Have INordPoolPriceService take a per-date fetch delegate and expose ParseAndAdjust, moving the HA fetch call into NordPoolInit so the service can be registered singleton - Record the NordPool and boiler service lifetimes in AGENTS.md - Drop the unused persisted-state argument from the boiler test data helper
22 lines
850 B
C#
22 lines
850 B
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using NetDaemon.AppModel;
|
|
using NordPoolManager.Interface;
|
|
|
|
namespace NordPoolManager;
|
|
|
|
public static class NordPoolServiceRegistration
|
|
{
|
|
public static IServiceCollection AddNordPool(this IServiceCollection services)
|
|
{
|
|
services
|
|
.AddNetDaemonApp<NordPoolInit>()
|
|
// Singleton is safe: NordPoolPriceService holds no IHaContext/generated
|
|
// entity dependency. The HA price fetch call lives in NordPoolInit.
|
|
.AddSingleton<INordPoolPriceService, NordPoolPriceService>()
|
|
.AddTransient<INordPoolEntityService, NordPoolEntityService>()
|
|
.AddTransient<ICheapestIntervalsFinder, CheapestIntervalsFinder>()
|
|
.AddScoped<INordPoolBoilerConfigProvider, NordPoolBoilerConfigProvider>();
|
|
|
|
return services;
|
|
}
|
|
} |