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

Commit 806d6bf

Browse files
committed
fix regression/merge
1 parent dc68fa6 commit 806d6bf

File tree

3 files changed

+9
-35
lines changed

3 files changed

+9
-35
lines changed

Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs

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

145145
List<InheritanceMappingAttribute> ProcessEntityType(IEntityType et)
146146
{
147-
mappings.Add(new()
147+
if (!et.ClrType.IsAbstract)
148148
{
149-
Type = et.ClrType, Code = entityType.GetDiscriminatorValue()
150-
});
149+
mappings.Add(new()
150+
{
151+
Type = et.ClrType,
152+
Code = entityType.GetDiscriminatorValue()
153+
});
154+
}
151155

152156
if (et.BaseType == null)
153157
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
}

Tests/LinqToDB.EntityFrameworkCore.SqlServer.Tests/ToolsTests.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -882,37 +882,6 @@ public void TestTagWith([Values(true, false)] bool enableFilter)
882882
}
883883
}
884884

885-
886-
[Test]
887-
public void TestTemporalTables([Values(true, false)] bool enableFilter)
888-
{
889-
using (var ctx = CreateContext(enableFilter))
890-
{
891-
var query1 = ctx.Products.TemporalAsOf(DateTime.UtcNow);
892-
var query2 = ctx.Products.TemporalFromTo(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow);
893-
var query3 = ctx.Products.TemporalAll();
894-
var query4 = ctx.Products.TemporalBetween(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow);
895-
var query5 = ctx.Products.TemporalContainedIn(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow);
896-
897-
var result1 = query1.ToLinqToDB().ToArray();
898-
var result2 = query2.ToLinqToDB().ToArray();
899-
var result3 = query3.ToLinqToDB().ToArray();
900-
var result4 = query4.ToLinqToDB().ToArray();
901-
var result5 = query5.ToLinqToDB().ToArray();
902-
903-
var allQuery =
904-
from p in ctx.Products.ToLinqToDB()
905-
from q1 in ctx.Products.TemporalAsOf(DateTime.UtcNow).Where(q => q.ProductId == p.ProductId).DefaultIfEmpty()
906-
from q2 in ctx.Products.TemporalFromTo(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow).Where(q => q.ProductId == p.ProductId).DefaultIfEmpty()
907-
from q3 in ctx.Products.TemporalAll().Where(q => q.ProductId == p.ProductId).DefaultIfEmpty()
908-
from q4 in ctx.Products.TemporalBetween(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow).Where(q => q.ProductId == p.ProductId).DefaultIfEmpty()
909-
from q5 in ctx.Products.TemporalContainedIn(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow).Where(q => q.ProductId == p.ProductId).DefaultIfEmpty()
910-
select p;
911-
912-
var result = allQuery.ToArray();
913-
}
914-
}
915-
916885
[Test]
917886
public void TestInheritanceBulkCopy([Values] BulkCopyType copyType)
918887
{

0 commit comments

Comments
 (0)