• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lucaslorentz / auto-compute / 11744711953

08 Nov 2024 03:11PM UTC coverage: 82.369%. First build
11744711953

push

github

lucaslorentz
Add initial support for computed navigations and observers

185 of 334 new or added lines in 17 files covered. (55.39%)

1509 of 1832 relevant lines covered (82.37%)

116.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/LLL.AutoCompute.EFCore/Metadata/Internal/ComputedRuntimeAnnotations.cs
1
using System.Diagnostics.CodeAnalysis;
2
using Microsoft.EntityFrameworkCore.Infrastructure;
3

4
namespace LLL.AutoCompute.EFCore.Metadata.Internal;
5

6
public class ComputedRuntimeAnnotation<T>(string name)
7✔
7
{
8
    public void SetRuntime(IAnnotatable annotatable, T value)
9
    {
10
        annotatable.SetRuntimeAnnotation(name, value);
8✔
11
    }
12

13
    public T GetRuntime(IAnnotatable annotatable)
14
    {
15
        if (!TryGetRuntime(annotatable, out var value))
197✔
NEW
16
            throw new Exception($"Cannot find annotation {name} in {annotatable}");
×
17

18
        return value;
197✔
19
    }
20

21
    public bool TryGetRuntime(IAnnotatable annotatable, [NotNullWhen(true)] out T? value)
22
    {
23
        var annotation = annotatable.FindRuntimeAnnotation(name);
197✔
24
        if (annotation is null)
197✔
25
        {
NEW
26
            value = default;
×
NEW
27
            return false;
×
28
        }
29

30
        value = (T)annotation.Value!;
197✔
31
        return true;
197✔
32
    }
33

34
    public T GetOrAddRuntime<TArg>(
35
        IAnnotatable annotatable,
36
        Func<TArg?, T> valueFactory,
37
        TArg? factoryArgument)
38
    {
39
        return annotatable.GetOrAddRuntimeAnnotationValue(
821✔
40
            name,
821✔
41
            valueFactory,
821✔
42
            factoryArgument);
821✔
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc