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

lucaslorentz / auto-compute / 11773655885

11 Nov 2024 06:55AM UTC coverage: 76.843% (-0.4%) from 77.292%
11773655885

push

github

lucaslorentz
Prevent annotations from appearing in migtations

6 of 18 new or added lines in 3 files covered. (33.33%)

1470 of 1913 relevant lines covered (76.84%)

109.03 hits per line

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

14.29
/src/LLL.AutoCompute.EFCore/Metadata/Conventions/RemoveComputedAnnotationsConvention.cs
1
using LLL.AutoCompute.EFCore.Metadata.Internal;
2
using Microsoft.EntityFrameworkCore;
3
using Microsoft.EntityFrameworkCore.Metadata;
4
using Microsoft.EntityFrameworkCore.Metadata.Builders;
5
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
6

7
namespace LLL.AutoCompute.EFCore.Metadata.Conventions;
8

9
class RemoveComputedAnnotationsConvention : IModelFinalizingConvention
10
{
11
    public void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)
12
    {
13
        if (!EF.IsDesignTime)
8✔
14
            return;
8✔
15

NEW
16
        var annotatables = modelBuilder.Metadata.GetEntityTypes()
×
NEW
17
            .SelectMany(e => new IConventionAnnotatable[] { e }.Concat(e.GetMembers().OfType<IConventionAnnotatable>()))
×
NEW
18
            .Concat([modelBuilder.Metadata])
×
NEW
19
            .ToArray();
×
20

NEW
21
        foreach (var annotatable in annotatables)
×
22
        {
NEW
23
            var computedAnnotations = annotatable
×
NEW
24
                .GetAnnotations()
×
NEW
25
                .Where(a => a.Name.StartsWith(ComputedAnnotationNames.Prefix))
×
NEW
26
                .ToArray();
×
27

NEW
28
            if (computedAnnotations.Length > 0)
×
29
            {
NEW
30
                foreach (var annotation in computedAnnotations)
×
NEW
31
                    annotatable.RemoveAnnotation(annotation.Name);
×
32
            }
33
        }
34
    }
35
}
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