Breeze 不会用可选的反向 属性 填充一对多导航 属性

Breeze doesn't fill one-to-many navigation property with optional inverse property

我有以下 类:

public class SalesProduct
{
    public int Id { get; set; }
    public ICollection<Image> ProductImages { get; set; }
}

public class Image
{
    public int Id { get; set; }
    public int? SalesProductId { get; set; }
    public virtual SalesProduct SalesProduct { get; set; }
}

和 SalesProduct 的 Fluent API 配置:

HasMany(x => x.ProductImages)
    .WithOptional(x => x.SalesProduct)
    .HasForeignKey(x => x.SalesProductId);

SalesProductProductImages 集合,EF 将它发送到前端,但 Breeze 不填充它(它的长度为 0)。它应该工作吗?我错过了什么吗?

编辑:关系是在后端使用预先加载加载的。

ProductImages 也需要标记为 virtual 以便 EF 延迟加载相关实体

public virtual ICollection<Image> ProductImages { get; set; }

应该有用!一段时间后它开始工作,没有采取任何行动。