Fix: Remove AsNoTracking to enable navigation property fixup
AsNoTracking() prevents EF Core from properly wiring up navigation properties.
Removing it allows Include() to populate Variants collection correctly.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b05645d526
commit
91bcdad9db
@ -24,7 +24,6 @@ public class ProductService : IProductService
|
|||||||
.Include(p => p.MultiBuys)
|
.Include(p => p.MultiBuys)
|
||||||
.Include(p => p.Variants)
|
.Include(p => p.Variants)
|
||||||
.Where(p => p.IsActive)
|
.Where(p => p.IsActive)
|
||||||
.AsNoTracking()
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return products.Select(p => new ProductDto
|
return products.Select(p => new ProductDto
|
||||||
@ -87,7 +86,6 @@ public class ProductService : IProductService
|
|||||||
.Include(p => p.MultiBuys)
|
.Include(p => p.MultiBuys)
|
||||||
.Include(p => p.Variants)
|
.Include(p => p.Variants)
|
||||||
.Where(p => p.IsActive && p.CategoryId == categoryId)
|
.Where(p => p.IsActive && p.CategoryId == categoryId)
|
||||||
.AsNoTracking()
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return products.Select(p => new ProductDto
|
return products.Select(p => new ProductDto
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user