Skip to content

Commit

Permalink
Exposed Evaluators collection as protected in specification evaluator…
Browse files Browse the repository at this point in the history
…s. (#328)
  • Loading branch information
fiseni authored May 26, 2023
1 parent 929ea8c commit 0805a1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public class SpecificationEvaluator : ISpecificationEvaluator
// Will use singleton for default configuration. Yet, it can be instantiated if necessary, with default or provided evaluators.
public static SpecificationEvaluator Default { get; } = new SpecificationEvaluator();

private readonly List<IEvaluator> evaluators = new List<IEvaluator>();
protected List<IEvaluator> Evaluators { get; } = new List<IEvaluator>();

public SpecificationEvaluator()
{
this.evaluators.AddRange(new IEvaluator[]
this.Evaluators.AddRange(new IEvaluator[]
{
WhereEvaluator.Instance,
SearchEvaluator.Instance,
Expand All @@ -26,7 +26,7 @@ public SpecificationEvaluator()
}
public SpecificationEvaluator(IEnumerable<IEvaluator> evaluators)
{
this.evaluators.AddRange(evaluators);
this.Evaluators.AddRange(evaluators);
}

/// <inheritdoc/>
Expand All @@ -48,7 +48,7 @@ public virtual IQueryable<T> GetQuery<T>(IQueryable<T> query, ISpecification<T>
{
if (specification is null) throw new ArgumentNullException("Specification is required");

var evaluators = evaluateCriteriaOnly ? this.evaluators.Where(x => x.IsCriteriaEvaluator) : this.evaluators;
var evaluators = evaluateCriteriaOnly ? this.Evaluators.Where(x => x.IsCriteriaEvaluator) : this.Evaluators;

foreach (var evaluator in evaluators)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class SpecificationEvaluator : ISpecificationEvaluator
/// </summary>
public static SpecificationEvaluator Cached { get; } = new SpecificationEvaluator(true);

private readonly List<IEvaluator> evaluators = new List<IEvaluator>();
protected List<IEvaluator> Evaluators { get; } = new List<IEvaluator>();

public SpecificationEvaluator(bool cacheEnabled = false)
{
this.evaluators.AddRange(new IEvaluator[]
this.Evaluators.AddRange(new IEvaluator[]
{
WhereEvaluator.Instance,
SearchEvaluator.Instance,
Expand All @@ -40,7 +40,7 @@ public SpecificationEvaluator(bool cacheEnabled = false)

public SpecificationEvaluator(IEnumerable<IEvaluator> evaluators)
{
this.evaluators.AddRange(evaluators);
this.Evaluators.AddRange(evaluators);
}

/// <inheritdoc/>
Expand All @@ -62,7 +62,7 @@ public virtual IQueryable<T> GetQuery<T>(IQueryable<T> query, ISpecification<T>
{
if (specification is null) throw new ArgumentNullException("Specification is required");

var evaluators = evaluateCriteriaOnly ? this.evaluators.Where(x => x.IsCriteriaEvaluator) : this.evaluators;
var evaluators = evaluateCriteriaOnly ? this.Evaluators.Where(x => x.IsCriteriaEvaluator) : this.Evaluators;

foreach (var evaluator in evaluators)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public class InMemorySpecificationEvaluator : IInMemorySpecificationEvaluator
// Will use singleton for default configuration. Yet, it can be instantiated if necessary, with default or provided evaluators.
public static InMemorySpecificationEvaluator Default { get; } = new InMemorySpecificationEvaluator();

private readonly List<IInMemoryEvaluator> evaluators = new List<IInMemoryEvaluator>();
protected List<IInMemoryEvaluator> Evaluators { get; } = new List<IInMemoryEvaluator>();

public InMemorySpecificationEvaluator()
{
this.evaluators.AddRange(new IInMemoryEvaluator[]
this.Evaluators.AddRange(new IInMemoryEvaluator[]
{
WhereEvaluator.Instance,
SearchEvaluator.Instance,
Expand All @@ -26,7 +26,7 @@ public InMemorySpecificationEvaluator()
}
public InMemorySpecificationEvaluator(IEnumerable<IInMemoryEvaluator> evaluators)
{
this.evaluators.AddRange(evaluators);
this.Evaluators.AddRange(evaluators);
}

public virtual IEnumerable<TResult> Evaluate<T, TResult>(IEnumerable<T> source, ISpecification<T, TResult> specification)
Expand All @@ -47,7 +47,7 @@ public virtual IEnumerable<TResult> Evaluate<T, TResult>(IEnumerable<T> source,

public virtual IEnumerable<T> Evaluate<T>(IEnumerable<T> source, ISpecification<T> specification)
{
foreach (var evaluator in evaluators)
foreach (var evaluator in Evaluators)
{
source = evaluator.Evaluate(source, specification);
}
Expand Down

0 comments on commit 0805a1e

Please sign in to comment.