2021-11-15 13:23:02 +00:00
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
|
|
|
|
|
2022-05-09 09:39:46 +02:00
|
|
|
namespace Umbraco.Cms.Web.Common.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
internal class ScopedServiceProvider : IScopedServiceProvider
|
2021-11-15 13:23:02 +00:00
|
|
|
{
|
2022-05-09 09:39:46 +02:00
|
|
|
private readonly IHttpContextAccessor _accessor;
|
2021-11-15 13:23:02 +00:00
|
|
|
|
2022-05-09 09:39:46 +02:00
|
|
|
public ScopedServiceProvider(IHttpContextAccessor accessor) => _accessor = accessor;
|
2021-11-15 13:23:02 +00:00
|
|
|
|
2022-05-09 09:39:46 +02:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public IServiceProvider? ServiceProvider => _accessor.HttpContext?.RequestServices;
|
2021-11-15 13:23:02 +00:00
|
|
|
}
|