2013-04-22 123 views
1

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

有人可以向我解释为什么他们中的任何一个本身不够?

在此先感谢!

回答

0

显然,关联属性丢失。使用[包含]使用[关联](在两个相关的实体中,第一个参数的名称相同)。

这里的例子

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; 
} 

}