【问题标题】:RIA Services: Entities with child entitiesRIA 服务:具有子实体的实体
【发布时间】:2011-04-08 18:22:50
【问题描述】:

是否可以在 RIA 服务实体上拥有本身也是实体的子对象?

public class Project
{
    [Key]
    public int ID { get; set; }

    [Editable(false)]
    public String Name { get; set; }

    public Machine Machine { get; set; }
}

public class Machine
{
    [Key]
    public int ID { get; set; }

    [Editable(false)]
    public String Name { get; set; }
}

【问题讨论】:

    标签: silverlight wcf-ria-services


    【解决方案1】:

    您可以在元数据类中的Machineproperty 上指定[Include] 属性,并在对象上下文查询中添加对Include("Machine") 的调用。

    见:http://vincenthomedev.wordpress.com/2010/01/08/using-wcf-ria-services-to-include-multi-table-master-detail-data/

    【讨论】:

    • 我没有使用实体框架。我正在使用 Linq to SQL 和 POCO/DTO。
    【解决方案2】:

    I don't think so,至少不是传统意义上的。

    【讨论】:

    • Colin 的博客是 RIA 服务的绝佳来源,但他的那篇文章有点字面意义上的 IMO。 RIA 服务支持大多数人期望的父/子概念。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-04
    • 2012-02-25
    • 1970-01-01
    • 2011-09-01
    • 2011-09-14
    • 1970-01-01
    相关资源
    最近更新 更多