Skip to content

Commit 6ffbb8b

Browse files
renemadsenclaude
andcommitted
fix: register PushNotificationService as scoped, not singleton
PushNotificationService injects TimePlanningPnDbContext (scoped) and reads from it in the constructor. A singleton registration causes "Cannot consume scoped service from singleton" at startup. Change to AddScoped so it gets a fresh DbContext per request. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 58e8d25 commit 6ffbb8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/EformTimePlanningPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void ConfigureServices(IServiceCollection services)
110110
services.AddTransient<IPayTimeBandRuleService, PayTimeBandRuleService>();
111111
services.AddTransient<IPayrollExportService, PayrollExportService>();
112112
services.AddTransient<IDeviceTokenService, DeviceTokenService>();
113-
services.AddSingleton<IPushNotificationService, PushNotificationService>();
113+
services.AddScoped<IPushNotificationService, PushNotificationService>();
114114
services.AddControllers();
115115
}
116116

0 commit comments

Comments
 (0)