我在使用Silverlight 5,Ria和实体框架时遇到问题。实体ria在保存后删除导航属性值
保存修改后的实体时,SubmitChanges()调用返回,其中一些实体的导航属性设置为null。保存正确发生;正确的值将被保存,如果稍后调用实体,则会正确读取值,导航属性将使用适当的值进行设置。
但客户端的背景是越来越空值和屏幕验证蹬更新
任何人都知道为什么会发生这种情况?
我试过刷新数据后保存;通过调用与LoadBehavior.RefreshCurrent相同的查询来填充屏幕。数据正在被其父母调用,因此当它被刷新时所有子实体现在都将其导航属性设置为空。不只是修改的实体。
public kcc_Incentive GetKcc_IncentiveByID(Guid IncentiveID)
{
//kcc_Incentive Incentive = this.ObjectContext.kcc_Incentive.Where(i => i.IncentiveId == IncentiveID).FirstOrDefault();
//if (Incentive != null)
//{
// Incentive.kcc_IncentiveProductType.Load(); //these are the entities I'm having trouble with
// foreach (kcc_IncentiveProductType t in Incentive.kcc_IncentiveProductType)
// {
// t.rate_FullModelReference.Load();
// t.rate_BaseModelReference.Load();
// t.rate_SeriesReference.Load();
// }
//}
//return Incentive;
//getting same results regardless of how it is loaded
return ObjectContext.kcc_Incentive
.Include("kcc_IncentiveProductType.rate_FullModel")
.Include("kcc_IncentiveProductType.rate_BaseModel")
.Include("kcc_IncentiveProductType.rate_Series")
.Include("kcc_IncentiveProductType.rate_ProductType.dms_Make")
.FirstOrDefault(i => i.IncentiveId == IncentiveID);
}
任何人都可以帮我保存我的价值后,他们已被保存?