public TResult Read(TQuery query) { TResult result; var queryName = query.GetType().Name; _logger.LogInformation($"Start reading query '{queryName}'" + Environment.NewLine); var stopwatch = new Stopwatch(); stopwatch.Start(); try { result = _decorated.Read(query); } catch (Exception e) { _logger.LogError($"Exception throw while reading query '{queryName}'" + Environment.NewLine + e.Message + Environment.NewLine); throw; } finally { stopwatch.Stop(); } _logger.LogInformation($"Executed query '{queryName}' in {stopwatch.Elapsed}." + Environment.NewLine); return(result); }
/// <summary> /// Runs the authorization rules for the specified query. /// </summary> /// <param name="query">The query.</param> /// <returns>TResult.</returns> public TResult Read(TQuery query) { _authorizationManager.Authorize(query); return(_decorated.Read(query)); }