[英]Entity Framework database first and RIA services navigation properties
I've inherited a Silverlight and RIA services project and it uses an EF4, database first DAL. 我继承了一个Silverlight和RIA服务项目,它使用了EF4,数据库优先DAL。
In the past when I used RIA services (the only other time I used it) it was with NHibernate so we had to mark all the entities with the appropriate [Association] and [Include] attributes. 在过去,当我使用RIA服务时(是我唯一的一次),它是与NHibernate一起使用的,因此我们必须使用适当的[Association]和[Include]属性标记所有实体。 This meant that our navigation properties were available in the Silverlight client application. 这意味着我们的导航属性在Silverlight客户端应用程序中可用。
At the time, I was under the impression that if we'd used Entity Framework instead of NHibernate, the generated EF model classes would be marked up with attributes that were not exactly [Association] and [Include] but were equivalent. 当时,我的印象是,如果使用Entity Framework而不是NHibernate,则生成的EF模型类将被标记为具有与[Association]和[Include]不完全相同的属性。
It appears that this isn't the case, my navigation properties for my model aren't available in the Silverlight client. 似乎并非如此,我的模型导航属性在Silverlight客户端中不可用。 Do I need to use metadata classes and add the [Association] properties manually to all the classes that require them? 我是否需要使用元数据类并将[Association]属性手动添加到需要它们的所有类中?
Thanks, 谢谢,
Ben 本
My Navigation properties were not present in the client side models because there was a metadata class for the entity which I was using but it only contained one property. 我的导航属性在客户端模型中不存在,因为我正在使用的实体有一个元数据类,但它仅包含一个属性。
The navigation property wasn't specified in the metadata class so wasn't available on the client. 导航属性未在元数据类中指定,因此在客户端上不可用。
The moral of the story is, you can't do "partial" metadata classes. 故事的寓意是,您不能执行“部分”元数据类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.