< Summary

Information
Class: Pozitron.QuerySpecification.AsNoTrackingWithIdentityResolutionEvaluator
Assembly: Pozitron.QuerySpecification.EntityFrameworkCore
File(s): /home/runner/work/QuerySpecification/QuerySpecification/src/QuerySpecification.EntityFrameworkCore/Evaluators/AsNoTrackingWithIdentityResolutionEvaluator.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/AsNoTrackingWithIdentityResolutionEvaluator.cs

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