Silverlight 4.0 从另一个实体中获取EntityCollection
我有一个entityA,其中包含entityB的EntityCollection。 我更新了EntityA的metdata,在定义entityB的行上添加了[include]装饰,如下所示:Silverlight 4.0 从另一个实体中获取EntityCollection,silverlight-4.0,wcf-ria-services,Silverlight 4.0,Wcf Ria Services,我有一个entityA,其中包含entityB的EntityCollection。 我更新了EntityA的metdata,在定义entityB的行上添加了[include]装饰,如下所示: [Include] public EntityCollection<daily> daily { get; set; } var summary = (from S in ObjectContext.summery.Include("daily") where
[Include]
public EntityCollection<daily> daily { get; set; }
var summary =
(from S in ObjectContext.summery.Include("daily")
where S.daily_number == daily_number
&& S.month_number == month_number
&& S.period_id == period_id
select S).FirstOrDefault();
return summary;
从客户端我总是得到entityB的计数零。
我在这里错过了什么
致以最诚挚的问候您需要定义
夏季
和每日
与的关联
编辑:
作为对瓦利德评论的回应,复合外键关联可能看起来像
[Association("SomeUniqueName",
"summery_field1, summary_field2, summary_field3",
"parent_summary_filed1, parent_summary_filed2, parent_summary_filed3",
IsForeignKey = false)]
您好,Ed,如果关联需要多个键,例如summary_field1、summary_field2、summary_field3和parent_summary_filed1、parent_summary_filed2、parent_summary_filed3??
public class summery
{
...
public int? summery_id { get; set; }
...
}
public class daily
{
...
// Foreign key to the parent summery
public int parent_summery_id { get; set; }
...
}
[Association("SomeUniqueName",
"summery_field1, summary_field2, summary_field3",
"parent_summary_filed1, parent_summary_filed2, parent_summary_filed3",
IsForeignKey = false)]