示例#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();
     }
 }
示例#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()
     };
 }