【问题标题】:Silverlight WCF RIA IncludeSilverlight WCF RIA 包括
【发布时间】:2013-04-22 09:44:45
【问题描述】:

在我使用 RIA 服务的 Silverlight 应用程序中,我必须在元数据文件中使用 [Include],在 DomainServiceClass 文件中使用 ObjectContext.Include("WhatEver")

有人可以向我解释为什么其中任何一个都不够吗?

提前致谢!

【问题讨论】:

    标签: wcf silverlight include ria


    【解决方案1】:

    显然缺少关联属性。与 [Include] 一起使用 [Association](在两个相关 Entities 中,第一个参数同名)。

    这里是一个例子

    class Toto
    {
    
    
    public int? Id
    {
    get;
    set;
    }
    
    [Include]
    [Association("Titi_Toto", "Id", "TotoId")]
    public IList<Titi> TitiList
    {
    get;
    set;
    }
    
    }
    
    ....
    
    class Titi
    {
    
    
    public int? Id
    {
    get;
    set;
    }
    
    public int? TotoId
    {
    get;
    set;
    }
    
    [Include]
    [Association("Titi_Toto", "TotoId", "Id", IsForeighKey=True)]
    public Toto TotoRef
    {
    get;
    set;
    }
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      相关资源
      最近更新 更多