I've got a Silverlight app using RIA services and LINQ2SQL and have objects in my Silverlight app.

I query all the records in a table (via a LINQ query, using a datacontext) in the Silverlight app and create a user control for each object (record) and put that object into the control because I need the information later. Then later, the user makes changes to that object (stored in the control) and I want to save it back to the database.

My problem is that when I go to save the object I have no datacontext to execute SubmitChanges against. I can't attach it to a new context because it says it's already attached.

What the best practice for this situation?

1

There are 1 answers

2
Robert Harvey On

Create a new DataContext, use it to retrieve the record in question, make your changes to the record, and execute SubmitChanges().