async Task <SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment) { // check... Monitor.Enter(_headersLock); SessionHeaderItem header = null; try { if (Headers.TryGetValue(environment.SessionId, out header) == false) { var conn = GetConnection(); header = await conn.Table <SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync(); if (header == null) { header = SessionHeaderItem.CreateForEnvironment(environment); await conn.InsertAsync(header); } // set... Headers[environment.SessionId] = header; } } finally { Monitor.Exit(_headersLock); } // return... return(header); }
private async Task<SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment) { // check... Monitor.Enter(_headersLock); SessionHeaderItem header = null; try { if (Headers.TryGetValue(environment.SessionId, out header) == false) { var conn = GetConnection(); header = await conn.Table<SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync(); if (header == null) { header = SessionHeaderItem.CreateForEnvironment(environment); await conn.InsertAsync(header); } // set... Headers[environment.SessionId] = header; } } finally { Monitor.Exit(_headersLock); } // return... return header; }
private async Task <SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment) { // check... lock (_headersLock) { if (Headers.ContainsKey(environment.SessionId)) { return(Headers[environment.SessionId]); } } var conn = GetConnection(); var header = await conn.Table <SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync(); if (header == null) { header = SessionHeaderItem.CreateForEnvironment(environment); await conn.InsertAsync(header); } // set... lock (_headersLock) { if (!(Headers.ContainsKey(environment.SessionId))) { Headers[environment.SessionId] = header; } } // return... return(header); }
private async Task<SessionHeaderItem> GetSessionAsync(ILoggingEnvironment environment) { // check... lock (_headersLock) { if (Headers.ContainsKey(environment.SessionId)) return Headers[environment.SessionId]; } var conn = GetConnection(); var header = await conn.Table<SessionHeaderItem>().Where(v => v.SessionGuid == environment.SessionId).FirstOrDefaultAsync(); if(header == null) { header = SessionHeaderItem.CreateForEnvironment(environment); await conn.InsertAsync(header); } // set... lock (_headersLock) { if (!(Headers.ContainsKey(environment.SessionId))) Headers[environment.SessionId] = header; } // return... return header; }
internal static SessionHeaderItem CreateForEnvironment(ILoggingEnvironment environment) { return(new SessionHeaderItem() { SessionGuid = environment.SessionId, Data = environment.ToJson() }); }
internal static SessionHeaderItem CreateForEnvironment(ILoggingEnvironment environment) { return new SessionHeaderItem() { SessionGuid = environment.SessionId, Data = environment.ToJson() }; }
static LogWriteContext() { _environment = new LoggingEnvironment(); }
internal JsonPostWrapper(ILoggingEnvironment environment, IEnumerable<LogEventInfo> events) { this.Environment = environment; this.Events = events.ToArray(); }
static LogWriteContext() { _environment = PlatformAdapter.Resolve<ILoggingEnvironment>(); }
internal JsonPostWrapper(ILoggingEnvironment environment, IEnumerable <LogEventInfo> events) { Environment = environment; Events = events.ToArray(); }
static LogWriteContext() { _environment = PlatformAdapter.Resolve <ILoggingEnvironment>(); }