Try: Use AsSplitQuery to force separate SQL queries for navigation properties
This may help EF Core properly materialize the Variants collection. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ public class ProductService : IProductService
|
||||
.Include(p => p.MultiBuys)
|
||||
.Include(p => p.Variants)
|
||||
.Where(p => p.IsActive)
|
||||
.AsSplitQuery()
|
||||
.ToListAsync();
|
||||
|
||||
return products.Select(p => new ProductDto
|
||||
@@ -86,6 +87,7 @@ public class ProductService : IProductService
|
||||
.Include(p => p.MultiBuys)
|
||||
.Include(p => p.Variants)
|
||||
.Where(p => p.IsActive && p.CategoryId == categoryId)
|
||||
.AsSplitQuery()
|
||||
.ToListAsync();
|
||||
|
||||
return products.Select(p => new ProductDto
|
||||
|
||||
Reference in New Issue
Block a user