我有这段代码:
while (length > 0) {
productArrival.productDetailsOptionValues()[length - 1].entityAspect.setDetached();
length = length - 1;
但是现在它在setDetached
处抛出错误。
错误是:
Uncaught TypeError: Cannot read property 'value' of null
这是在我升级到EF6和最新的breezeJs后开始发生的。有什么想法吗?
编辑:
更多信息。上面导航属性的表定义是:
public class ProductDetailOptionValue
{
public int ProductDetailsId { get; set; }
[ForeignKey("ProductDetailsId")]
[InverseProperty("ProductDetailsOptionValues")]
public ProductDetails ProductDetail { get; set; }
public int OptionValueId { get; set; }
[ForeignKey("OptionValueId")]
[InverseProperty("ProductDetailsOptionValues")]
public OptionValue OptionValue { get; set; }
}
其他父实体的定义如下:
public class ProductDetails
{
[Required]
public virtual int ProductDetailsId { get; set; }
public int ProductId { get; set; }
[ForeignKey("ProductId")]
[InverseProperty("Details")]
public virtual Product Product { get; set; }
[InverseProperty("ProductDetail")]
public virtual ICollection<ProductDetailOptionValue> ProductDetailsOptionValues { get; set; }
}
和
public class OptionValue
{
[Required]
public virtual int OptionValueId { get; set; }
[Required]
public virtual string Value { get; set; }
public int ProductOptionsId { get; set; }
[ForeignKey("ProductOptionsId")]
[InverseProperty("OptionValues")]
public virtual ProductOptions Option { get; set; }
[InverseProperty("OptionValue")]
public virtual ICollection<ProductDetailOptionValue> ProductDetailsOptionValues { get; set; }
}
编辑2:
我试着在Breezejs里调试一下。它在这种方法中崩溃:
function __arrayRemoveItem(array, predicateOrItem, shouldRemoveMultiple) {
var predicate = __isFunction(predicateOrItem) ? predicateOrItem : undefined;
var lastIx = array.length - 1;
var removed = false;
for (var i = lastIx; i >= 0; i--) {
if (predicate ? predicate(array[i]) : (array[i] === predicateOrItem)) {
array.splice(i, 1); // #####CRASHES HERE######
removed = true;
if (!shouldRemoveMultiple) {
return true;
}
}
}
return removed;
}