Adding a GroupBy specification example
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.eShopWeb.Infrastructure.Data
|
||||
{
|
||||
@@ -38,6 +35,11 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
|
||||
query = query.OrderByDescending(specification.OrderByDescending);
|
||||
}
|
||||
|
||||
if (specification.GroupBy != null)
|
||||
{
|
||||
query = query.GroupBy(specification.GroupBy).SelectMany(x => x);
|
||||
}
|
||||
|
||||
// Apply paging if enabled
|
||||
if (specification.isPagingEnabled)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user