【发布时间】:2020-01-13 12:38:48
【问题描述】:
使用 Entity Framework Core 3.1 我正在删除几个篮子中的所有产品:
IQueryable<baskets> baskets = _context.Baskets.Where(x => x.Value <= 10);
_context.RemoveRange(baskets.Select(x => x.Products));
在 RemoveRange 命令我得到错误:
'System.InvalidOperationException' in Microsoft.EntityFrameworkCore.dll:
'The entity type 'HashSet<Product>' was not found.
Ensure that the entity type has been added to the model.'
我能够创建、更新和删除一项。
问题仅在于RemoveRange。我错过了什么?
【问题讨论】:
标签: entity-framework-core entity-framework-core-3.1