Ejemplo n.º 1
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();
     }
 }
Ejemplo n.º 2
0
 private static RequestLogEntry GetRequestEntity(HttpRequest request, string hash)
 {
     return new RequestLogEntry()
     {
         Created = DateTime.UtcNow,
         Hash = hash,
         Method = request.Method,
         Url = request.RequestUri.ToString()
     };
 }