为什么下面返回的实体不更新?即使 stocktakeid 变量具有值,它们在 Get 上为空,并且在 Save(在数据库中)之后保持为空。
protected void GetPipelineState()
{
InventoryModelDataContext context = new InventoryModelDataContext(this.ConnectionString);
var f = from pe in context.StockTakePipelines
where pe.StockTakeId == null
select pe;
this.PipeLine = f;
}
protected void SavePipelineState()
{
InventoryModelDataContext context = new InventoryModelDataContext(this.ConnectionString);
foreach (StockTakePipeline p in this.PipeLine)
{
p.StockTakeId = this.StockTakeId;
}
context.SubmitChanges();
}
编辑:重新PK