简体   繁体   English

实体框架数据库优先和RIA服务导航属性

[英]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.

相关问题 具有继承和RIA服务的实体框架模型 - Entity Framework Model with inheritance and RIA Services 实体框架/ RIA服务包括不工作 - Entity Framework / RIA Services Include not working 将数据从WCF Ria Services绑定到数据网格Entity Framework Code First - Bind data from WCF Ria Services to data grid Entity Framework Code First Ria Services:使用另一个项目的实体框架代码优先级 - Ria Services : Use Entity Framework Code First Classes From Another Project RIA服务调用操作返回具有实体属性的复杂类型 - RIA Services Invoke Operation return Complex Type with Entity properties 我可以在实体框架4.3中使用RIA服务吗? - Can I use RIA Services with Entity Framework 4.3? 实体框架与WCF RIA服务的紧密程度如何? - How closely is Entity Framework tied to WCF RIA Services? 仅使用实体框架和RIA服务更新已修改的列 - Update modified columns only, with Entity Framework and RIA services 带有RIA服务的实体框架,Silverlight - 脱钩与快速开发的权衡 - Entity Framework with RIA services, Silverlight - tradeoff of decoupling versus rapid development 如何编辑绑定到ria服务然后绑定到Entity Framework和SQL递归表的Silverlight树视图数据 - How to Edit a Silverlight treeview data bound to ria services then to Entity Framework and SQL recursive table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM