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