1
在我使用RIA服務的Silverlight應用程序中,我必須在元數據文件中使用[Include]
,在DomainServiceClass文件中使用ObjectContext.Include("WhatEver")
。Silverlight WCF RIA包括
有人可以向我解釋爲什麼他們中的任何一個本身不夠?
在此先感謝!
在我使用RIA服務的Silverlight應用程序中,我必須在元數據文件中使用[Include]
,在DomainServiceClass文件中使用ObjectContext.Include("WhatEver")
。Silverlight WCF RIA包括
有人可以向我解釋爲什麼他們中的任何一個本身不夠?
在此先感謝!
顯然,關聯屬性丟失。使用[包含]使用[關聯](在兩個相關的實體中,第一個參數的名稱相同)。
這裏的例子
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;
}
}