After remove() + refresh() child-record still in cachedList
Posted: Thu 15 Dec 2011 13:52
Hello,
I have a parent and a child table (a Person can have multiple bank-accounts).
If a users makes some changes and then wants to move to another 'Person' or closes the form, he gets a question: 'Do you want to save the changes'.
If he says 'no' I need to get back to the old values, so I do a
this.DB.Refresh(RefreshMode.OverwriteCurrentValues, Person);
The problem arises when the user added a child-record (a new bank-account).
I know refresh() only works for updates, so I remove the child-record first:
Person.Child-Table.Remove(brek);
this.DB.Refresh(RefreshMode.OverwriteCurrentValues, Person);
I can see that the child-record no longer referes to the Person (is null), and in the Person-record
Person.Child-Table.Count = 0
(In the properties window I have: ("Delete On Null = True")
But...the Person still shows the (just deleted) bankacount!
If I do a save(), this just deleted record is also saved.
In the watch-window I can see (Non-Public members) that the "cachedList" still holds the just deleted child.
How can I fix this?
I have a parent and a child table (a Person can have multiple bank-accounts).
If a users makes some changes and then wants to move to another 'Person' or closes the form, he gets a question: 'Do you want to save the changes'.
If he says 'no' I need to get back to the old values, so I do a
this.DB.Refresh(RefreshMode.OverwriteCurrentValues, Person);
The problem arises when the user added a child-record (a new bank-account).
I know refresh() only works for updates, so I remove the child-record first:
Person.Child-Table.Remove(brek);
this.DB.Refresh(RefreshMode.OverwriteCurrentValues, Person);
I can see that the child-record no longer referes to the Person (is null), and in the Person-record
Person.Child-Table.Count = 0
(In the properties window I have: ("Delete On Null = True")
But...the Person still shows the (just deleted) bankacount!
If I do a save(), this just deleted record is also saved.
In the watch-window I can see (Non-Public members) that the "cachedList" still holds the just deleted child.
How can I fix this?