< Summary

Information
Class: Pozitron.QuerySpecification.AsTrackingEvaluator
Assembly: Pozitron.QuerySpecification.EntityFrameworkCore
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/AsTrackingEvaluator.cs
Tag: 67_15587897385
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 25
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
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%22100%

File(s)

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

#LineLine coverage
 1namespace Pozitron.QuerySpecification;
 2
 3/// <summary>
 4/// Evaluator to apply AsTracking to the query if the specification has AsTracking set to true.
 5/// </summary>
 6[EvaluatorDiscovery(Order = 120)]
 7public sealed class AsTrackingEvaluator : IEvaluator
 8{
 9    /// <summary>
 10    /// Gets the singleton instance of the <see cref="AsTrackingEvaluator"/> class.
 11    /// </summary>
 212    public static AsTrackingEvaluator Instance = new();
 413    private AsTrackingEvaluator() { }
 14
 15    /// <inheritdoc/>
 16    public IQueryable<T> Evaluate<T>(IQueryable<T> source, Specification<T> specification) where T : class
 17    {
 5118        if (specification.AsTracking)
 19        {
 120            source = source.AsTracking();
 21        }
 22
 5123        return source;
 24    }
 25}