I have a web service to get an object, such as
public Blah GetBlah(int blahID) {
var db = new BlahContext...
}
and another web service
public UpdateBlah(int blahID) {
var db = new BlahContext...
var blah = GetBLah(blahID);
blah.someVariable = false;
... // how do I save this object?
}
But I don’t think I can do SubmitChanges as the object was not created in the same context.
When you call
UpdateBlahyou need to pass the object as parameter so you can have the data to update.Then you can choose two alternatives:
1. Mapping (manual or auto)
2. Attach
You can
attachthe object to the new datacontext