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

loresoft / EntityFrameworkCore.Generator / 27730465225

18 Jun 2026 01:21AM UTC coverage: 74.693% (+19.8%) from 54.885%
27730465225

push

github

pwelter34
update tests

922 of 1609 branches covered (57.3%)

Branch coverage included in aggregate %.

7 of 7 new or added lines in 2 files covered. (100.0%)

230 existing lines in 23 files now uncovered.

4007 of 4990 relevant lines covered (80.3%)

1258.69 hits per line

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

84.38
/src/EntityFrameworkCore.Generator.Core/Parsing/ContextParser.cs
1
using EntityFrameworkCore.Generator.Metadata.Parsing;
2

3
using Microsoft.CodeAnalysis.CSharp;
4
using Microsoft.CodeAnalysis.CSharp.Syntax;
5
using Microsoft.Extensions.Logging;
6

7
namespace EntityFrameworkCore.Generator.Parsing;
8

9
public class ContextParser
10
{
11
    private readonly ILogger _logger;
12

13
    public ContextParser(ILoggerFactory loggerFactory)
4✔
14
    {
15
        _logger = loggerFactory.CreateLogger<ContextParser>();
4✔
16
    }
4✔
17

18
    public ParsedContext? ParseFile(string contextFile)
19
    {
20
        if (string.IsNullOrEmpty(contextFile) || !File.Exists(contextFile))
1!
UNCOV
21
            return null;
×
22

23
        _logger.LogDebug(
1✔
24
            "Parsing Context File: '{ContextFile}'",
1✔
25
            Path.GetFileName(contextFile));
1✔
26

27
        var code = File.ReadAllText(contextFile);
1✔
28
        return ParseCode(code);
1✔
29
    }
30

31
    public ParsedContext? ParseCode(string code)
32
    {
33
        if (string.IsNullOrWhiteSpace(code))
4!
UNCOV
34
            return null;
×
35

36
        var syntaxTree = CSharpSyntaxTree.ParseText(code);
4✔
37
        var root = (CompilationUnitSyntax)syntaxTree.GetRoot();
4✔
38

39
        var visitor = new ContextVisitor();
4✔
40
        visitor.Visit(root);
4✔
41

42
        var parsedContext = visitor.ParsedContext;
4✔
43
        if (parsedContext == null)
4✔
44
            return null;
1✔
45

46
        _logger.LogDebug(
3✔
47
            "Parsed Context Class: {ContextClass}; Entities: {Entities}",
3✔
48
            parsedContext.ContextClass,
3✔
49
            parsedContext.Properties.Count);
3✔
50

51
        return parsedContext;
3✔
52
    }
53
}
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