fix ยืมคืนเครื่องราชย?มาใช้่ RootDnaId แทน rootId
This commit is contained in:
parent
65e85b7194
commit
14fd93ae95
9 changed files with 21340 additions and 22 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Insignia.Service.Configuration;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Insignia.Service.Configuration;
|
||||
using SocketIOClient;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
|
@ -9,16 +10,17 @@ public class InsigniaRequestProcessService : BackgroundService
|
|||
{
|
||||
private readonly IBackgroundTaskQueue _queue;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
|
||||
public InsigniaRequestProcessService(
|
||||
IBackgroundTaskQueue queue,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
_queue = queue;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
||||
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -73,6 +75,14 @@ public class InsigniaRequestProcessService : BackgroundService
|
|||
var endTime = DateTime.Now;
|
||||
var duration = endTime - startTime;
|
||||
|
||||
// Resolve repository from a scope because DbContext is scoped/transient.
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
var userProfileRepository = (UserProfileRepository)scope.ServiceProvider.GetService(typeof(UserProfileRepository));
|
||||
if (userProfileRepository != null)
|
||||
{
|
||||
await userProfileRepository.PostInsigniaMessageToSocket("Task completed", UserId ?? "", AccessToken);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue