Added possibility to chain includes. (#331)

* Added possibility to chain includes.

* Removed interface.

* Removed the need for generating GUIDs as ids and added tests.
This commit is contained in:
mrukas
2019-12-16 15:42:04 +01:00
committed by Eric Fleming
parent 9695e9e3ba
commit 13fc6ea546
14 changed files with 478 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
using System;
using System.Linq.Expressions;
using System.Collections.Generic;
using Microsoft.eShopWeb.ApplicationCore.Helpers.Query;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications
{
@@ -26,6 +27,13 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
{
Includes.Add(includeExpression);
}
protected virtual void AddIncludes<TProperty>(Func<IncludeAggregator<T>, IIncludeQuery<T, TProperty>> includeGenerator)
{
var includeQuery = includeGenerator(new IncludeAggregator<T>());
IncludeStrings.AddRange(includeQuery.Paths);
}
protected virtual void AddInclude(string includeString)
{
IncludeStrings.Add(includeString);