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

lucaslorentz / auto-compute / 19783212428

29 Nov 2025 11:22AM UTC coverage: 82.741%. Remained the same
19783212428

push

github

lucaslorentz
Rename annotations

21 of 30 new or added lines in 2 files covered. (70.0%)

1793 of 2167 relevant lines covered (82.74%)

877.31 hits per line

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

76.6
/src/LLL.AutoCompute.EFCore/Metadata/Internal/AutoComputeAnnotationAccessors.cs
1
using System.Linq.Expressions;
2
using LLL.AutoCompute.EFCore.Internal;
3
using Microsoft.EntityFrameworkCore.Metadata;
4

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

7
public static class AutoComputeAnnotationAccessors
8
{
9
    internal static EFCoreObservedEntityType GetOrCreateObservedEntityType(this IEntityType entityType)
10
    {
11
        return entityType.GetOrAddRuntimeAnnotationValue(
2,570✔
12
            AutoComputeAnnotationNames.ObservedEntityType,
2,570✔
13
            static (entityType) => new EFCoreObservedEntityType(entityType!),
2,618✔
14
            entityType);
2,570✔
15
    }
16

17
    internal static EFCoreObservedEntityType? GetObservedEntityType(this IEntityType entityType)
18
    {
19
        return entityType.FindRuntimeAnnotationValue(
×
NEW
20
            AutoComputeAnnotationNames.ObservedEntityType) as EFCoreObservedEntityType;
×
21
    }
22

23
    internal static EFCoreObservedProperty GetOrCreateObservedProperty(this IProperty property)
24
    {
25
        return property.GetOrAddRuntimeAnnotationValue(
810✔
26
            AutoComputeAnnotationNames.ObservedMember,
810✔
27
            static (property) => new EFCoreObservedProperty(property!),
950✔
28
            property);
810✔
29
    }
30

31
    internal static EFCoreObservedProperty? GetObservedProperty(this IProperty property)
32
    {
33
        return property.FindRuntimeAnnotationValue(
×
NEW
34
            AutoComputeAnnotationNames.ObservedMember) as EFCoreObservedProperty;
×
35
    }
36

37
    internal static EFCoreObservedNavigation GetOrCreateObservedNavigation(this INavigationBase navigation)
38
    {
39
        return navigation.GetOrAddRuntimeAnnotationValue(
1,972✔
40
            AutoComputeAnnotationNames.ObservedMember,
1,972✔
41
            static (navigation) => new EFCoreObservedNavigation(navigation!),
2,050✔
42
            navigation);
1,972✔
43
    }
44

45
    internal static EFCoreObservedNavigation? GetObservedNavigation(this INavigationBase navigation)
46
    {
47
        return navigation.FindRuntimeAnnotationValue(
×
NEW
48
            AutoComputeAnnotationNames.ObservedMember) as EFCoreObservedNavigation;
×
49
    }
50

51
    internal static EFCoreObservedMember? GetObservedMember(this IPropertyBase member)
52
    {
53
        return member.FindRuntimeAnnotationValue(
1,468✔
54
            AutoComputeAnnotationNames.ObservedMember) as EFCoreObservedMember;
1,468✔
55
    }
56

57
    internal static ComputedMemberFactory<IProperty>? GetComputedFactory(this IReadOnlyProperty target)
58
    {
59
        return target[AutoComputeAnnotationNames.MemberFactory] as ComputedMemberFactory<IProperty>;
444✔
60
    }
61

62
    internal static void SetComputedFactory(this IMutableProperty target, ComputedMemberFactory<IProperty> factory)
63
    {
64
        target[AutoComputeAnnotationNames.MemberFactory] = factory;
231✔
65
    }
66

67
    internal static ComputedMemberFactory<INavigationBase>? GetComputedFactory(this IReadOnlyNavigationBase target)
68
    {
69
        return target[AutoComputeAnnotationNames.MemberFactory] as ComputedMemberFactory<INavigationBase>;
302✔
70
    }
71

72
    internal static void SetComputedFactory(this IMutableNavigationBase target, ComputedMemberFactory<INavigationBase> factory)
73
    {
74
        target[AutoComputeAnnotationNames.MemberFactory] = factory;
3✔
75
    }
76

77
    internal static List<ComputedObserverFactory<IEntityType>>? GetObserversFactories(this IReadOnlyEntityType target)
78
    {
79
        return target[AutoComputeAnnotationNames.ObserversFactories] as List<ComputedObserverFactory<IEntityType>>;
134✔
80
    }
81

82
    internal static void AddObserverFactory(this IMutableEntityType target, ComputedObserverFactory<IEntityType> factory)
83
    {
84
        var factories = target.GetObserversFactories();
18✔
85
        if (factories is null)
18✔
86
        {
87
            factories = [];
18✔
88
            target[AutoComputeAnnotationNames.ObserversFactories] = factories;
18✔
89
        }
90
        factories.Add(factory);
18✔
91
    }
92

93
    public static ComputedMember? GetComputedMember(this IPropertyBase target)
94
    {
95
        return target.FindRuntimeAnnotationValue(AutoComputeAnnotationNames.Member) as ComputedMember;
258✔
96
    }
97

98
    internal static void SetComputedMember(this IPropertyBase propertyBase, ComputedMember? computedMember)
99
    {
100
        propertyBase.SetRuntimeAnnotation(AutoComputeAnnotationNames.Member, computedMember);
156✔
101
    }
102

103
    public static IReadOnlyCollection<ComputedObserver>? GetComputedObservers(this IEntityType target)
104
    {
NEW
105
        return target.FindRuntimeAnnotationValue(AutoComputeAnnotationNames.Observers) as IReadOnlyCollection<ComputedObserver>;
×
106
    }
107

108
    internal static void SetComputedObservers(this IEntityType target, IReadOnlyCollection<ComputedObserver>? computedObservers)
109
    {
110
        target.SetRuntimeAnnotation(AutoComputeAnnotationNames.Observers, computedObservers);
12✔
111
    }
112

113
    public static IComputedExpressionAnalyzer<IEFCoreComputedInput> GetComputedExpressionAnalyzerOrThrow(this IModel annotatable)
114
    {
115
        return annotatable.FindRuntimeAnnotationValue(AutoComputeAnnotationNames.ExpressionAnalyzer) as IComputedExpressionAnalyzer<IEFCoreComputedInput>
156✔
116
            ?? throw new Exception($"ExpressionAnalyzer not found in model");
156✔
117
    }
118

119
    internal static void SetExpressionAnalyzer(this IModel annotatable, IComputedExpressionAnalyzer<IEFCoreComputedInput> analyzer)
120
    {
121
        annotatable.SetRuntimeAnnotation(AutoComputeAnnotationNames.ExpressionAnalyzer, analyzer);
20✔
122
    }
123

124
    public static IReadOnlyList<ComputedMember> GetAllComputedMembers(this IModel annotatable)
125
    {
126
        return annotatable.FindRuntimeAnnotationValue(AutoComputeAnnotationNames.AllMembers) as IReadOnlyList<ComputedMember>
244✔
127
            ?? throw new Exception($"{AutoComputeAnnotationNames.AllMembers} annotation not found in model");
244✔
128
    }
129

130
    internal static void SetAllComputedMembers(this IModel annotatable, IReadOnlyList<ComputedMember> computeds)
131
    {
132
        annotatable.SetRuntimeAnnotation(AutoComputeAnnotationNames.AllMembers, computeds);
20✔
133
    }
134

135
    public static IReadOnlyList<ComputedObserver> GetAllComputedObservers(this IModel annotatable)
136
    {
137
        return annotatable.FindRuntimeAnnotationValue(AutoComputeAnnotationNames.AllObservers) as IReadOnlyList<ComputedObserver>
244✔
138
            ?? throw new Exception($"{AutoComputeAnnotationNames.AllObservers} annotation not found in model");
244✔
139
    }
140

141
    internal static void SetAllComputedObservers(this IModel annotatable, IReadOnlyList<ComputedObserver> computeds)
142
    {
143
        annotatable.SetRuntimeAnnotation(AutoComputeAnnotationNames.AllObservers, computeds);
20✔
144
    }
145

146
    internal static LambdaExpression? GetConsistencyFilter(
147
        this IEntityType entityType)
148
    {
NEW
149
        return entityType[AutoComputeAnnotationNames.ConsistencyFilter] as LambdaExpression;
×
150
    }
151

152
    internal static void SetConsistencyFilter(
153
        this IMutableEntityType entityType,
154
        LambdaExpression filter)
155
    {
NEW
156
        entityType[AutoComputeAnnotationNames.ConsistencyFilter] = filter;
×
157
    }
158

159
    public static LambdaExpression? GetConsistencyCheck(this IReadOnlyPropertyBase target)
160
    {
NEW
161
        return target[AutoComputeAnnotationNames.ConsistencyCheck] as LambdaExpression;
×
162
    }
163

164
    internal static void SetConsistencyCheck(this IMutableProperty propertyBase, LambdaExpression check)
165
    {
NEW
166
        propertyBase[AutoComputeAnnotationNames.ConsistencyCheck] = check;
×
167
    }
168
}
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