Why don’t the entities returned below update? They are null on the Get and remain null after the Save (in the db) even though the stocktakeid variable has values.
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();
}
EDIT : Re PK

You’re changing entities from the
contextlocal toGetPipelineState(), and then callingSubmitChanges()on thecontextlocal toSavePipelineState().Try something more like:
Edit:
Just a note for someone else finding this question. Another thing that will cause entities to not update is if they don’t implement
INotifyPropertyChangingandINotifyPropertyChanged, which they normally will, but won’t if either you hand-code the class and forget to implement those, or if the table has no primary key (in which case there’s no way to do an update on a given row anyway since it can’t be identified, and the code gen drops the implementation of those now-pointless interfaces as an optimisation).