After remove() + refresh() child-record still in cachedList
After remove() + refresh() child-record still in cachedList
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?
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
I've sent you a test project, please check that it was not blocked by your mail filter.
In the sample, an entity is loaded from the database and modified. Besides that, a new 'child' entity is added. After that, the new 'child' entity is removed, and the first entity is refreshed with the values loaded from the database. In our environment, this results in no changes being saved for either the first or the 'child' object.
Please specify what should be changed in the sample to reproduce the issue, or send us your test project.
In the sample, an entity is loaded from the database and modified. Besides that, a new 'child' entity is added. After that, the new 'child' entity is removed, and the first entity is refreshed with the values loaded from the database. In our environment, this results in no changes being saved for either the first or the 'child' object.
Please specify what should be changed in the sample to reproduce the issue, or send us your test project.
Hello Stanislav,
Your test projects works fine here. But then, in your project, the cachedList from DEPT, is always 'null'.
If I make a binding in XAML (DataContext="{Binding Path=EMPs}") the cachedList is filled. Is ther some documentation on this cachedList?
I alterd the project the way I work with it. I also added a document with some snapshots from my watch-window. I send this to your email-account.
Will you please look at it again?
Thank you,
Your test projects works fine here. But then, in your project, the cachedList from DEPT, is always 'null'.
If I make a binding in XAML (DataContext="{Binding Path=EMPs}") the cachedList is filled. Is ther some documentation on this cachedList?
I alterd the project the way I work with it. I also added a document with some snapshots from my watch-window. I send this to your email-account.
Will you please look at it again?
Thank you,
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48