Refactored event service injection
This commit is contained in:
@@ -22,12 +22,15 @@ public sealed class NonCompliantProjectEvent : IEvent
|
||||
}
|
||||
|
||||
public sealed class NonCompliantProjectEventHandler(IDbContextFactory<ApplicationDbContext> contextFactory,
|
||||
ICommunicationsService service) : INotificationHandler<NonCompliantProjectEvent>
|
||||
IServiceProvider provider) : INotificationHandler<NonCompliantProjectEvent>
|
||||
{
|
||||
public async ValueTask Handle(NonCompliantProjectEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||
|
||||
var scope = provider.CreateScope().ServiceProvider;
|
||||
var service = scope.GetRequiredService<ICommunicationsService>();
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
// Fetch active/monitored projects with programme, portfolio, and award organisations
|
||||
|
||||
Reference in New Issue
Block a user