Dedect pending changes in DLinq DataContext

A

Andrus

I have invoice editing WinForms form containing TextBox controls and
DataGridView.
Text boxes are bound to entity properties, grid is bound to BindingList of
entities.
Entitites are returned from DLinq query and implement
INotifyPropertyChanged.

If user closes form I need to check for unsaved changes are present and
prompt user to save them.

How to check that DataContext has pending changes ?
I havent found such function.
So should I add property IsDirty to form and set/reset it manually by
trapping every property change event ?
Or is it possible to examine DataContext for pending changes ?

Andrus.
 
F

Frans Bouma [C# MVP]

Andrus said:
I have invoice editing WinForms form containing TextBox controls and
DataGridView.
Text boxes are bound to entity properties, grid is bound to
BindingList of entities. Entitites are returned from DLinq query and
implement INotifyPropertyChanged.

If user closes form I need to check for unsaved changes are present
and prompt user to save them.

How to check that DataContext has pending changes ?
I havent found such function.
So should I add property IsDirty to form and set/reset it manually by
trapping every property change event ? Or is it possible to examine
DataContext for pending changes ?

datacontext.GetChangedSet() ?

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top