-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessageFacade.cs
More file actions
28 lines (23 loc) · 873 Bytes
/
MessageFacade.cs
File metadata and controls
28 lines (23 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using AzureDevopsTracker.Entities;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
namespace AzureDevopsTracker.Integrations
{
internal class MessageFacade
{
private readonly IServiceScopeFactory _serviceScopeFactory;
public MessageFacade(
IServiceScopeFactory serviceScopeFactory)
{
_serviceScopeFactory = serviceScopeFactory;
}
public async Task Send(ChangeLog changeLog)
{
using var scope = _serviceScopeFactory.CreateScope();
var messageIntegration = scope.ServiceProvider.GetService<MessageIntegration>();
if (messageIntegration is null) throw new Exception("Configure the MessageConfig in Startup to send changelog messages");
await messageIntegration.Send(changeLog);
}
}
}