public virtual void SetXscfModuleDto() { if (Uid.IsNullOrEmpty()) { throw new XscfPageException(null, "页面未提供UID!"); } var xscfModule = _xscfModuleService.Value.GetObject(z => z.Uid == Uid); if (xscfModule == null) { throw new XscfPageException(null, "尚未注册 XSCF 模块,UID:" + Uid); } _xscfModuleDto = _xscfModuleService.Value.Mapper.Map <XscfModuleDto>(xscfModule); }
public EntityStore(TDbContext context, BaseErrorDescriber errorDescriber, ILoggerFactory loggerFactory, IConfiguration configuration) { Logger = loggerFactory.CreateLogger(GetType()); Context = context ?? throw new ArgumentNullEx(nameof(context)); Context.Configuration = configuration; Mapper = Context.Database.GetService <IMapper>(); cache = GetServices <IDistributedCache>(); ErrorDescriber = errorDescriber ?? throw new ArgumentNullEx(nameof(errorDescriber)); httpContextAccessor = GetServices <IHttpContextAccessor>(); Uid = httpContextAccessor?.HttpContext?.User?.FindFirstValue("id"); if (Uid.IsNullOrEmpty()) { Uid = string.Empty; } }