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

loresoft / EntityFrameworkCore.Generator / 27799729863

19 Jun 2026 01:26AM UTC coverage: 71.762% (+1.3%) from 70.481%
27799729863

push

github

pwelter34
Adjust README and fix SQL type mapping

985 of 1863 branches covered (52.87%)

Branch coverage included in aggregate %.

4217 of 5386 relevant lines covered (78.3%)

1278.11 hits per line

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

66.67
/src/EntityFrameworkCore.Generator.Core/Extensions/TypeExtensions.cs
1
namespace EntityFrameworkCore.Generator.Extensions;
2

3
public static class TypeExtensions
4
{
5
    /// <summary>
6
    /// Gets the underlying type dealing with <see cref="T:Nullable`1"/>.
7
    /// </summary>
8
    /// <param name="type">The type.</param>
9
    /// <returns>Returns a type dealing with <see cref="T:Nullable`1"/>.</returns>
10
    public static Type GetUnderlyingType(this Type type)
11
    {
12
        ArgumentNullException.ThrowIfNull(type);
234✔
13
        return Nullable.GetUnderlyingType(type) ?? type;
234!
14
    }
15

16
    /// <summary>
17
    /// Determines whether the specified <paramref name="type"/> can be null.
18
    /// </summary>
19
    /// <param name="type">The type to check.</param>
20
    /// <returns>
21
    ///   <c>true</c> if the specified <paramref name="type"/> can be null; otherwise, <c>false</c>.
22
    /// </returns>
23
    public static bool IsNullable(this Type type)
24
    {
25
        ArgumentNullException.ThrowIfNull(type);
×
26

27
        if (!type.IsGenericType || type.IsGenericTypeDefinition)
×
28
            return false;
×
29

30
        // Instantiated generic type only
31
        Type genericType = type.GetGenericTypeDefinition();
×
32
        return ReferenceEquals(genericType, typeof(Nullable<>));
×
33
    }
34

35
    public static bool IsNumeric(this Type type)
36
    {
37
        type = type.GetUnderlyingType();
117✔
38

39
        return type.IsInteger()
117✔
40
            || type == typeof(decimal)
117✔
41
            || type == typeof(float)
117✔
42
            || type == typeof(double);
117✔
43
    }
44

45
    public static bool IsInteger(this Type type)
46
    {
47
        type = type.GetUnderlyingType();
117✔
48

49
        return type == typeof(int)
117✔
50
            || type == typeof(long)
117✔
51
            || type == typeof(short)
117✔
52
            || type == typeof(byte)
117✔
53
            || type == typeof(uint)
117✔
54
            || type == typeof(ulong)
117✔
55
            || type == typeof(ushort)
117✔
56
            || type == typeof(sbyte)
117✔
57
            || type == typeof(char);
117✔
58
    }
59

60
    public static bool IsSignedInteger(this Type type)
61
        => type == typeof(int)
×
62
            || type == typeof(long)
×
63
            || type == typeof(short)
×
64
            || type == typeof(sbyte);
×
65
}
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