c# - Entity Framework Core - Skip & Take result in multuple queries with SELECT TOP(1) -
i'm fetching records azuresql using ef paging (skip & top). code:
var query = _context.kits .include(k => k.kitstatuses) .where(t => t.x == y) .orderby(t => t.z) .skip(skip) .take(pagesize).select(t => new { id = t.id, barcode = t.barcode, ... }).tolistasync();
the probelm there should 1 query select top(pagesize) in profiler can see 1 query per record (on included kitstatuses table):
exec sp_executesql n'select top(1) [k3].[updated] [kitstatuses] [k3] ([k3].[status] = 1) , (@_outer_id1 = [k3].[kit_id])',n'@_outer_id1 uniqueidentifier',@_outer_id1='868780f2-c121-c209-65f1-08d4442d5a8a'
any ideas why?
if not include child collection works fine (1 query).
thank & kind regards, h3k0
Comments
Post a Comment