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

DomCR / ACadSharp / 18679672476

21 Oct 2025 09:40AM UTC coverage: 77.906% (-0.2%) from 78.126%
18679672476

Pull #832

github

web-flow
Merge e48c45ee6 into 03242f9d6
Pull Request #832: multileader dxf

6923 of 9695 branches covered (71.41%)

Branch coverage included in aggregate %.

341 of 429 new or added lines in 16 files covered. (79.49%)

77 existing lines in 8 files now uncovered.

26671 of 33426 relevant lines covered (79.79%)

110330.18 hits per line

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

84.31
/src/ACadSharp/DxfClassMap.cs
1
using ACadSharp.Attributes;
2
using System;
3
using System.Collections.Concurrent;
4
using System.Reflection;
5

6
namespace ACadSharp
7
{
8
        public class DxfClassMap : DxfMapBase
9
        {
10
                /// <summary>
11
                /// Cache of created DXF mapped classes.
12
                /// </summary>
13
                private static readonly ConcurrentDictionary<Type, DxfClassMap> _cache = new ConcurrentDictionary<Type, DxfClassMap>();
1✔
14

15
                public DxfClassMap() : base()
26,195✔
16
                {
26,195✔
17
                }
26,195✔
18

19
                public DxfClassMap(string name) : base()
2,306✔
20
                {
2,306✔
21
                        this.Name = name;
2,306✔
22
                }
2,306✔
23

24
                /// <summary>
25
                /// Creates a DXF map of the passed type.
26
                /// </summary>
27
                /// <remarks>
28
                ///   Will return a cached instance if it exists.  if not, it will be created on call.
29
                /// Use the <see cref="ClearCache"/> method to clear the cache and force a new mapping to be created.
30
                /// </remarks>
31
                /// <typeparam name="T">Type of CadObject to map.</typeparam>
32
                /// <returns>Mapped class</returns>
33
                public static DxfClassMap Create<T>()
34
                        where T : CadObject
35
                {
34,308✔
36
                        return Create(typeof(T));
34,308✔
37
                }
34,308✔
38

39
                /// <summary>
40
                /// Clears the map cache.
41
                /// </summary>
42
                public void ClearCache()
NEW
43
                {
×
NEW
44
                        _cache.Clear();
×
NEW
45
                }
×
46

47
                /// <inheritdoc/>
48
                public override string ToString()
NEW
49
                {
×
NEW
50
                        return $"DxfClassMap:{this.Name}";
×
NEW
51
                }
×
52

53
                internal static DxfClassMap Create(Type type, string name = null)
54
                {
41,508✔
55
                        if (_cache.TryGetValue(type, out var classMap))
41,508✔
56
                        {
41,453✔
57
                                return classMap;
41,453✔
58
                        }
59

60
                        classMap = new DxfClassMap();
55✔
61

62
                        if (string.IsNullOrEmpty(name))
55✔
63
                        {
53✔
64
                                var att = type.GetCustomAttribute<DxfSubClassAttribute>();
53✔
65
                                if (att == null)
53!
NEW
66
                                        throw new ArgumentException($"{type.FullName} is not a dxf subclass");
×
67
                                classMap.Name = att.ClassName;
53✔
68
                        }
53✔
69
                        else
70
                        {
2✔
71
                                classMap.Name = name;
2✔
72
                        }
2✔
73

74
                        addClassProperties(classMap, type);
55✔
75

76
                        DxfSubClassAttribute baseAtt = type.BaseType.GetCustomAttribute<DxfSubClassAttribute>();
55✔
77
                        if (baseAtt != null && baseAtt.IsEmpty)
55✔
78
                        {
20✔
79
                                //Properties in the table seem to be embeded to the hinerit type
80
                                addClassProperties(classMap, type.BaseType);
20✔
81
                        }
20✔
82

83
                        _cache.TryAdd(type, classMap);
55✔
84

85
                        return classMap;
55✔
86
                }
41,508✔
87
        }
88
}
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