views:

22

answers:

1

If all of my wpf controls bind to ObservableCollections and I am using linq-2-sql to populate these collections, what is the correct way to commit changes whenever properties of these objects are updated?

Currently I am calling DataClassesDataContext.SubmitChanges() manually, which is a bit tedious. Is there a way to do this automatically, so I don't have to have these calls all over the place?

A: 

Typically you'd just commit the changes when the user clicks a "Save" or "OK" button on a given form.

Going to the DB on every change sounds like overkill, but I don't know the details of your particular application.

Jay
I don't have save or ok buttons on my screens, only for dialog windows. Basically I have many pages that must commit prior to navigation to another page.
Shatterling
@Shatterling What is the mechanism by which navigation occurs? Can you create/subscribe to an event before navigation occurs?
Jay