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

loresoft / EntityFrameworkCore.Generator / 27760980405

18 Jun 2026 12:56PM UTC coverage: 75.418% (+0.7%) from 74.693%
27760980405

push

github

pwelter34
fix build

1007 of 1723 branches covered (58.44%)

Branch coverage included in aggregate %.

4221 of 5209 relevant lines covered (81.03%)

1242.99 hits per line

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

89.29
/src/EntityFrameworkCore.Generator.Core/Templates/CodeTemplateBase.cs
1
using System.Text;
2

3
using EntityFrameworkCore.Generator.Extensions;
4
using EntityFrameworkCore.Generator.Options;
5
using EntityFrameworkCore.Generator.Parsing;
6

7
namespace EntityFrameworkCore.Generator.Templates;
8

9
public abstract class CodeTemplateBase
10
{
11

12
    protected CodeTemplateBase(GeneratorOptions options)
1,256✔
13
    {
14
        Options = options;
1,256✔
15
        CodeBuilder = new IndentedStringBuilder();
1,256✔
16
        RegionReplace = new RegionReplace();
1,256✔
17
    }
1,256✔
18

19
    public GeneratorOptions Options { get; }
20

21
    protected RegionReplace RegionReplace { get; }
22

23
    protected IndentedStringBuilder CodeBuilder { get; }
24

25
    public virtual void WriteCode(string path)
26
    {
27
        var fullPath = Path.GetFullPath(path);
1,247✔
28
        var directory = Path.GetDirectoryName(fullPath);
1,247✔
29

30
        if (directory.HasValue() && !Directory.Exists(directory))
1,247!
31
            Directory.CreateDirectory(directory);
421✔
32

33
        var output = WriteCode();
1,247✔
34

35
        if (File.Exists(fullPath))
1,247✔
36
            RegionReplace.MergeFile(fullPath, output);
23✔
37
        else
38
            File.WriteAllText(fullPath, output);
1,224✔
39
    }
1,224✔
40

41
    public abstract string WriteCode();
42

43
    protected static string? ToXmlText(string? value)
44
    {
45
        if (value.IsNullOrEmpty())
12,019!
46
            return value;
×
47

48
        return value
12,019✔
49
            .Replace("&", "&")
12,019✔
50
            .Replace("<", "&lt;")
12,019✔
51
            .Replace(">", "&gt;");
12,019✔
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