Breeze在元数据中返回导航属性,但不在实体上返回 [英] Breeze returns navigation properties in the metadata, but not on the entities

查看:92
本文介绍了Breeze在元数据中返回导航属性,但不在实体上返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题已经过完全编辑,可以在进一步调查后实际概述根本问题。

我遇到了麻烦,没有导航属性出现在我的客户端元数据上。通过对轻巧的客户端代码进行更深入的检查,我发现 parseCsdlNavProperty (第6181行)中的以下代码导致了我的收藏集 all 导航属性应被忽略:

I was having trouble with no navigation properties appearing on my client side metadata. With deeper inspection of the breeze client side code, I've worked out that the following code in parseCsdlNavProperty (line 6181) is causing all my collection navigation properties to be ignored:

var constraint = association.referentialConstraint;
if (!constraint) {
    // TODO: Revisit this later - right now we just ignore many-many and assocs with missing constraints.
    return;
    // Think about adding this back later.
    //if (association.end[0].multiplicity == "*" && association.end[1].multiplicity == "*") {
    //    // many to many relation
    //    ???
    //} else {
    //    throw new Error("Foreign Key Associations must be turned on for this model");
    //}
}

属性referentialConstraint未定义,这导致轻轻松松忽略我的相关实体。问题是我不确定a)为什么它为null,b)这样做是什么,c)为什么当实体框架似乎很好地映射时,微风似乎讨厌这个,d)如何解决它。

The property referentialConstraint is undefined, and this causes breeze to ignore my related entites. Problem is I'm not sure a) why this is null, b) what this does, c) why breeze seems to hate this, when entity framework seems to be mapping things fine, d) how to fix it.

因此,我删除了我的整个元数据和模型示例,因为这些信息太多了。如果需要信息,请告诉我,我将其添加。

So I've removed my entire metadata and examples of my model because it's just too much information. If there is information required, just let me know and I'll add it.

希望这使问题更加具体,更易于理解。

Hopefully this makes the question a little more specific and easier to decipher.

谢谢。

推荐答案

唯一会丢失引用约束的原因模型是实体框架认为您没有公开外键的情况。参见外键在实体框架中

The only reason that you would be missing referential constraints in your model is if the Entity Framework thinks that you are not exposing foreign keys. See Foreign keys in the Entity Framework.

微风需要外键才能执行其自动对象链接逻辑。

Breeze requires the foreign keys in order to perform it's automatic object linking logic.

此处也对此进行了描述:微风导航属性

This is also described here: Breeze navigation properties

这篇关于Breeze在元数据中返回导航属性,但不在实体上返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆