private object TryGetInstance(string instanceKey, Func <object> createInstance) { try { object instance = createInstance(); if (!session.Contains(instanceKey)) { SetInstance(instanceKey, createInstance); } var sessionInstance = session.Get <object>(instanceKey); if (sessionInstance != null) { instance = sessionInstance; } return(instance); } catch (Exception ex) { Tracing.Start("Extensibility - Light Inject - PerSessionLifeTime - Start of Error"); Tracing.Error(ex.Message); Tracing.Error(ex.StackTrace); Tracing.Stop("Extensibility - Light Inject - PerSessionLifeTime - End of Error"); return(createInstance()); } }
public async Task <IPage <Session> > GetSessions(string credentialId, SessionFilter sessionFilter) { if (string.IsNullOrEmpty(credentialId)) { throw new ArgumentNullException(nameof(credentialId)); } if (sessionFilter == null) { throw new ArgumentNullException(nameof(sessionFilter)); } var filterClone = sessionFilter.Clone(); filterClone.CredentialId = credentialId; var page = await SessionStore.Get(filterClone); return(page); }
public async Task <IActionResult> GetByCredentialId([GetterParameter][FromRoute] string credentialId) { if (string.IsNullOrEmpty(credentialId)) { throw new ArgumentNullException(nameof(credentialId)); } UserAgentOverview agent = RequestInfoService.UserAgent; Session session = await SessionStore.Get(credentialId, agent.DeviceClass, agent.DeviceName, agent.AgentName, agent.AgentVersion); if (session == null) { return(NotFound()); } return(Element <Session>(session)); }
public virtual ISessionValue <T> Get <T>(string key) { return(SessionStore.Get <T>(CreatePrefixedSessionKey(key))); }