In that way you will get an older instance together with a new one in BLL and Attach will work correctly.
Another oddity here: If you use the Attach(cust,cust2) if the table has a Time Stamp field, Submit Changes also fails with: I suspect that's a bug in the way Attach updates the entity from the 'original state' and is inadvertantly updating the Time Stamp field.
This happens inside of the LINQ code - the Update never hits the SQL backend. It works - but if you ask me the process is about as clear as mud.
To update members of a child collection, you must explicitly call Attach and specify that entity.
Attach attaches all entities in the object graph of the provided object.
As it sits above the code will fail with: An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy.
So, as mentioned in the last post if there's no timestamp member or other 'versioning' mechanism provided there's apparently no way for LINQ to determine whether that data has changed.
The issue is this: I want to basically create an instance of an entity through LINQ then disconnect from LINQ's data context. Then I want to reattach it later to the context and have it appropriately update the database.
Now in the original example I used my own sample data and no matter what I tried it didn't work. I could not get updates to work (and in fact it still doesn't work with my data) but I did get it to work with Northwind.
I load an entity and disconnect the data context and then reattach it to a new data context: Now, if I do this out of the box with raw Northwind database the above code fails.
As was pointed out by several people you can't do the above because LINQ is essentially a connected model (not in terms of connections, but in terms of data context instancing) because LINQ to SQL requires the change state.
Do not try to Attach an entity that has not been detached through serialization.