This is a migrated thread and some comments may be shown as answers.

If collection changes will error be thrown?

2 Answers 56 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 17 Sep 2011, 01:22 AM
Hi there,

Just a quick question regarding the PersistenceFramework. I haven't used the feature yet but I have a scenario and I would like to know how the Framework will react to it.

Suppose I have TreeView filled dynamically from a database with various nodes and child nodes, say for example categories with sub products. If I save the properties of the treeview as is, and then later reload the treeview but its nodes have changed / been updated with newer products etc, will the persistence framework throw an error when reloaded with older persistence settings?

Thanks for your time and I hope I've explained myself adequately.

2 Answers, 1 is accepted

Sort by
0
Accepted
Alex Fidanov
Telerik team
answered on 17 Sep 2011, 04:56 PM
Hi Robert,

If I understood your scenario correctly, you have a bound the treeview control. If that is so, the persistence framework would not save the ItemsSource property. This is the default behavior, as we do not want to recreate your business objects, as their state might not be the same as when restored. For example - private setters, nested classes with no parameterless constructors, readonly collections cannot be recreated. What settings are you trying to save?

The persistence framework works with any UIElements and their properties. It is likely to have an unexpected result when the saved objects have different structure than the ones when restoring. However, it is possible to provide a custom serialization, which can keep track of the saved and loaded objects. A similar approach is used when using the persistence framework with the RadGridView control and its Columns. The columns are not directly serialized, but only their metadata, When loading, they are matched against the autogenerated columns of the GridView and the settings are restored. You can see this example in our online samples here.

Please let me know if you have questions on this matter.

All the best,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Robert
Top achievements
Rank 1
answered on 17 Sep 2011, 06:41 PM
Thanks very much. I haven't made anything that uses the persistence framework yet, I was just curious what would happen if I used it with a bound treeview or something similar just incase in do :-). Thank you again for your response. Rob
Tags
PersistenceFramework
Asked by
Robert
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Robert
Top achievements
Rank 1
Share this question
or