You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
972 B
26 lines
972 B
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.Extensions.Caching.Distributed;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
using System;
|
|
|
|
namespace CounsellorBL.BLStructure
|
|
{
|
|
public class ControllDataPack
|
|
{
|
|
public IServiceProvider ServiceProvider { get; set; }
|
|
|
|
public IMemoryCache MemoryCache => ServiceProvider == null ?
|
|
null :
|
|
ServiceProvider.GetService(typeof(IMemoryCache)) as IMemoryCache;
|
|
|
|
public IHttpContextAccessor HttpContextAccessor => ServiceProvider == null ?
|
|
null :
|
|
ServiceProvider.GetService(typeof(IHttpContextAccessor)) as IHttpContextAccessor;
|
|
|
|
//public IDistributedCache DistributedCache => ServiceProvider == null ?
|
|
// null :
|
|
// ServiceProvider.GetService(typeof(IDistributedCache)) as IDistributedCache;
|
|
|
|
public string GetIP => HttpContextAccessor?.HttpContext.Connection.RemoteIpAddress.ToString();
|
|
}
|
|
}
|