Example #1
0
 public async Task<RequestLogEntry> GetByHashAsync(string hash)
 {
     using (var context = new RequestLoggingContext())
     {
         return await context.Requests.FirstOrDefaultAsync(logEntry => logEntry.Hash == hash);
     }
 }
Example #2
0
 public async Task<List<RequestLogEntry>> GetAllAsync(Expression<Func<RequestLogEntry, bool>> predicate)
 {
     using (var context = new RequestLoggingContext())
     {
         return await context.Requests.Where(predicate).AsNoTracking().ToListAsync();
     }
 }
Example #3
0
 public async Task<List<RequestLogEntry>> GetAllAsync()
 {
     using (var context = new RequestLoggingContext())
     {
         return await context.Requests.AsNoTracking().ToListAsync();
     }
 }
Example #4
0
 public List<RequestLogEntry> GetAll()
 {
     using (var context = new RequestLoggingContext())
     {
         return context.Requests.AsNoTracking().ToList();
     }
 }
Example #5
0
 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();
     }
 }