-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
the subquery is not converted when using a split query.
example code:
public class Table1
{
public int Id { get; set; }
public List<Table2> Table2s { get; set; }
public List<Table3> Table3s { get; set; }
}
public class Table2
{
public int Id { get; set; }
public int Table1ID { get; set; }
public Table1 Table1 { get; set; }
}
public class Table3
{
public int Id { get; set; }
public int Table1ID { get; set; }
public Table1 Table1 { get; set; }
}
public class MyDbContext : DbContext
{
public MyDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Table1> Table1s { get; set; }
public DbSet<Table2> Table2s { get; set; }
public DbSet<Table3> Table3s { get; set; }
}
internal class Program
{
static void Main(string[] args)
{
var services = new ServiceCollection();
services.AddLogging(b => b.AddConsole());
services.AddDbContext<MyDbContext>(b =>
{
b.UseSqlServer("Data Source=localhost;Initial Catalog=TestDb1;Integrated Security=True;Encrypt=False;", s =>
{
s.UseRowNumberForPaging();
});
});
using var provider = services.BuildServiceProvider();
using (var scope = provider.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<MyDbContext>();
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
for (var i = 0; i < 100; i++)
{
context.Table1s.Add(new()
{
Table2s = new() {new(), new(), new(), new()},
Table3s = new() {new(), new(), new(), new()}
});
}
context.SaveChanges();
context.Table1s
.Include(x => x.Table2s)
.Include(x => x.Table3s)
.Skip(5)
.Take(5)
.AsSplitQuery() // using a split query
.ToList();
}
Console.ReadLine();
}
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
