public async Task<RequestLogEntry> GetByHashAsync(string hash) { using (var context = new RequestLoggingContext()) { return await context.Requests.FirstOrDefaultAsync(logEntry => logEntry.Hash == hash); } }
public async Task<List<RequestLogEntry>> GetAllAsync(Expression<Func<RequestLogEntry, bool>> predicate) { using (var context = new RequestLoggingContext()) { return await context.Requests.Where(predicate).AsNoTracking().ToListAsync(); } }
public async Task<List<RequestLogEntry>> GetAllAsync() { using (var context = new RequestLoggingContext()) { return await context.Requests.AsNoTracking().ToListAsync(); } }
public List<RequestLogEntry> GetAll() { using (var context = new RequestLoggingContext()) { return context.Requests.AsNoTracking().ToList(); } }
public async Task LogAsync(HttpRequest request, string hash = null) { RequestLogEntry requestEntity = GetRequestEntity(request, hash); using (var context = new RequestLoggingContext()) { context.Requests.Add(requestEntity); await context.SaveChangesAsync(); } }