Church.Net.API/WebAPI/Logics/Core/LogicService.cs
2022-09-30 09:40:42 -07:00

34 lines
887 B
C#

using Church.Net.DAL.EF;
using Microsoft.Extensions.DependencyInjection;
using WebAPI.Services;
namespace WebAPI.Logics.Core
{
public class LogicService
{
private readonly IServiceScopeFactory serviceScopeFactory;
public LogicService(
//ChurchNetContext dbContext
IServiceScopeFactory serviceScopeFactory
)
{
this.serviceScopeFactory = serviceScopeFactory;
//DbContext = dbContext;
}
//public ChurchNetContext DbContext { get; }
public string CurrentUserId
{
get
{
using (var scope = serviceScopeFactory.CreateScope())
{
var service = scope.ServiceProvider.GetService<IdentityService>();
return service.UserId;
}
}
}
}
}