public async Task <List <ProjectDto> > GetAllForProduct(int userId, int productId) { // TODO: [TESTS] (ProjectService.GetAllForProduct) Add tests // TODO: [VALIDATION] (ProjectService.GetAllForProduct) Ensure that the current user can see these var builder = new ServiceMetricBuilder(nameof(ProjectService), nameof(GetAllForProduct)) .WithCategory(MetricCategory.Project, MetricSubCategory.GetAll) .WithCustomInt1(userId) .WithCustomInt2(productId) .WithCustomInt3(0); try { using (builder.WithTiming()) { List <ProjectEntity> dbEntries; using (builder.WithCustomTiming1()) { builder.IncrementQueryCount(); dbEntries = await _projectRepo.GetAllForProduct(productId); builder.WithResultsCount(dbEntries.Count); } return(dbEntries .AsQueryable() .Select(ProjectDto.Projection) .ToList()); } } catch (Exception ex) { _logger.LogUnexpectedException(ex); builder.WithException(ex); return(new List <ProjectDto>()); } finally { await _metrics.SubmitPointAsync(builder.Build()); } }