< Summary

Information
Class: Pozitron.QuerySpecification.IncludeStringEvaluator
Assembly: Pozitron.QuerySpecification.EntityFrameworkCore
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/IncludeStringEvaluator.cs
Tag: 67_15587897385
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 29
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor()100%11100%
Evaluate(...)100%66100%

File(s)

/home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/IncludeStringEvaluator.cs

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3/// <summary>
 4/// Evaluates a specification to include navigation properties specified by string paths.
 5/// </summary>
 6[EvaluatorDiscovery(Order = 30)]
 7public sealed class IncludeStringEvaluator : IEvaluator
 8{
 9
 10    /// <summary>
 11    /// Gets the singleton instance of the <see cref="IncludeStringEvaluator"/> class.
 12    /// </summary>
 213    public static IncludeStringEvaluator Instance = new();
 414    private IncludeStringEvaluator() { }
 15
 16    /// <inheritdoc/>
 17    public IQueryable<T> Evaluate<T>(IQueryable<T> source, Specification<T> specification) where T : class
 18    {
 57619        foreach (var item in specification.Items)
 20        {
 23621            if (item.Type == ItemType.IncludeString && item.Reference is string includeString)
 22            {
 1123                source = source.Include(includeString);
 24            }
 25        }
 26
 5227        return source;
 28    }
 29}