Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 333c7bf

Browse files
committed
fix regression/merge
(cherry picked from commit 806d6bf)
1 parent b857ebb commit 333c7bf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,14 @@ static IEnumerable<InheritanceMappingAttribute> GetMappingAttributesRecursive(IE
141141

142142
List<InheritanceMappingAttribute> ProcessEntityType(IEntityType et)
143143
{
144-
mappings.Add(new()
144+
if (!et.ClrType.IsAbstract)
145145
{
146-
Type = et.ClrType, Code = entityType.GetDiscriminatorValue()
147-
});
146+
mappings.Add(new()
147+
{
148+
Type = et.ClrType,
149+
Code = entityType.GetDiscriminatorValue()
150+
});
151+
}
148152

149153
if (et.BaseType == null)
150154
return mappings;

Tests/LinqToDB.EntityFrameworkCore.BaseTests/ForMappingTestsBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,14 @@ public virtual async Task TestInheritance()
168168
using var context = CreateContext();
169169
using var connection = context.CreateLinqToDBConnection();
170170

171+
context.WithInheritance.AddRange(new List<WithInheritanceA>() { new() { } });
171172
context.WithInheritance.AddRange(new List<WithInheritanceA1>() { new() { }, new() { } });
172173
context.WithInheritance.AddRange(new List<WithInheritanceA2>() { new() { }, new() { } });
173174
await context.SaveChangesAsync();
174175

175176
var result = context.GetTable<WithInheritanceA>().ToList();
176177

177-
result.OfType<WithInheritance>().Should().HaveCount(4);
178+
result.OfType<WithInheritance>().Should().HaveCount(5);
178179
result.OfType<WithInheritanceA1>().Should().HaveCount(2);
179180
result.OfType<WithInheritanceA2>().Should().HaveCount(2);
180181
}

0 commit comments

Comments
 (0)