From 3bf14540255c28a6929bc3bad8b65ffc83d832d0 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 25 Sep 2017 22:43:22 -0400 Subject: [PATCH] Remove non-icon basket link from header Add comments to EF query logic --- src/Infrastructure/Data/EfRepository.cs | 9 +++++++++ src/Web/Views/Shared/_Layout.cshtml | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Infrastructure/Data/EfRepository.cs b/src/Infrastructure/Data/EfRepository.cs index cdc84fa..b0cecfa 100644 --- a/src/Infrastructure/Data/EfRepository.cs +++ b/src/Infrastructure/Data/EfRepository.cs @@ -43,25 +43,34 @@ namespace Infrastructure.Data public IEnumerable List(ISpecification spec) { + // fetch a Queryable that includes all expression-based includes var queryableResultWithIncludes = spec.Includes .Aggregate(_dbContext.Set().AsQueryable(), (current, include) => current.Include(include)); + + // modify the IQueryable to include any string-based include statements var secondaryResult = spec.IncludeStrings .Aggregate(queryableResultWithIncludes, (current, include) => current.Include(include)); + + // return the result of the query using the specification's criteria expression return secondaryResult .Where(spec.Criteria) .AsEnumerable(); } public async Task> ListAsync(ISpecification spec) { + // fetch a Queryable that includes all expression-based includes var queryableResultWithIncludes = spec.Includes .Aggregate(_dbContext.Set().AsQueryable(), (current, include) => current.Include(include)); + + // modify the IQueryable to include any string-based include statements var secondaryResult = spec.IncludeStrings .Aggregate(queryableResultWithIncludes, (current, include) => current.Include(include)); + // return the result of the query using the specification's criteria expression return await secondaryResult .Where(spec.Criteria) .ToListAsync(); diff --git a/src/Web/Views/Shared/_Layout.cshtml b/src/Web/Views/Shared/_Layout.cshtml index 998deb2..8803d10 100644 --- a/src/Web/Views/Shared/_Layout.cshtml +++ b/src/Web/Views/Shared/_Layout.cshtml @@ -33,8 +33,6 @@ @await Html.PartialAsync("_LoginPartial") -
Basket
-